Class: Graphql::Generators::TypeGeneratorBase::NormalizedField
- Inherits:
-
Object
- Object
- Graphql::Generators::TypeGeneratorBase::NormalizedField
- Defined in:
- lib/generators/graphql/type_generator.rb
Instance Method Summary collapse
-
#initialize(name, type_expr, null) ⇒ NormalizedField
constructor
A new instance of NormalizedField.
-
#to_input_argument ⇒ Object
-
#to_object_field ⇒ Object
Constructor Details
#initialize(name, type_expr, null) ⇒ NormalizedField
Returns a new instance of NormalizedField.
119 120 121 122 123 |
# File 'lib/generators/graphql/type_generator.rb', line 119 def initialize(name, type_expr, null) @name = name @type_expr = type_expr @null = null end |
Instance Method Details
#to_input_argument ⇒ Object
129 130 131 |
# File 'lib/generators/graphql/type_generator.rb', line 129 def to_input_argument "argument :#{@name}, #{@type_expr}, required: false" end |
#to_object_field ⇒ Object
125 126 127 |
# File 'lib/generators/graphql/type_generator.rb', line 125 def to_object_field "field :#{@name}, #{@type_expr}#{@null ? '' : ', null: false'}" end |