Class: TinyGQL::Nodes::VariableDefinition
- Defined in:
- lib/tinygql/nodes.rb
Instance Attribute Summary collapse
-
#default_value ⇒ Object
readonly
Returns the value of attribute default_value.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#variable ⇒ Object
readonly
Returns the value of attribute variable.
Instance Method Summary collapse
- #accept(viz) ⇒ Object
- #children ⇒ Object
- #fold(viz, seed) ⇒ Object
-
#initialize(variable, type, default_value) ⇒ VariableDefinition
constructor
A new instance of VariableDefinition.
- #variable_definition? ⇒ Boolean
Methods inherited from Node
#argument?, #boolean_value?, #directive?, #directive_definition?, #document?, #each, #enum_type_definition?, #enum_type_extension?, #enum_value?, #enum_value_definition?, #executable_directive_location?, #field?, #field_definition?, #float_value?, #fragment_definition?, #fragment_spread?, #inline_fragment?, #input_object_type_definition?, #input_object_type_extension?, #input_value_definition?, #int_value?, #interface_type_definition?, #interface_type_extension?, #list_type?, #list_value?, #named_type?, #not_null_type?, #null_value?, #object_field?, #object_type_definition?, #object_type_extension?, #object_value?, #operation_definition?, #root_operation_type_definition?, #scalar_type_definition?, #scalar_type_extension?, #schema_definition?, #string_value?, #type_condition?, #type_system_directive_location?, #union_type_definition?, #union_type_extension?, #value?, #variable?
Constructor Details
#initialize(variable, type, default_value) ⇒ VariableDefinition
Returns a new instance of VariableDefinition.
189 190 191 192 193 |
# File 'lib/tinygql/nodes.rb', line 189 def initialize variable, type, default_value @variable = variable @type = type @default_value = default_value end |
Instance Attribute Details
#default_value ⇒ Object (readonly)
Returns the value of attribute default_value.
187 188 189 |
# File 'lib/tinygql/nodes.rb', line 187 def default_value @default_value end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
187 188 189 |
# File 'lib/tinygql/nodes.rb', line 187 def type @type end |
#variable ⇒ Object (readonly)
Returns the value of attribute variable.
187 188 189 |
# File 'lib/tinygql/nodes.rb', line 187 def variable @variable end |
Instance Method Details
#accept(viz) ⇒ Object
195 196 197 |
# File 'lib/tinygql/nodes.rb', line 195 def accept viz viz.handle_variable_definition self end |
#children ⇒ Object
205 206 207 |
# File 'lib/tinygql/nodes.rb', line 205 def children ary = []; ary << variable; ary << type; ary << default_value if default_value; ary end |
#fold(viz, seed) ⇒ Object
199 200 201 |
# File 'lib/tinygql/nodes.rb', line 199 def fold viz, seed viz.handle_variable_definition self, seed end |
#variable_definition? ⇒ Boolean
203 |
# File 'lib/tinygql/nodes.rb', line 203 def variable_definition?; true; end |