Class: TinyGQL::Nodes::OperationDefinition

Inherits:
Node
  • Object
show all
Defined in:
lib/tinygql/nodes.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#start

Instance Method Summary collapse

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?, #line, #list_type?, #list_value?, #named_type?, #not_null_type?, #null_value?, #object_field?, #object_type_definition?, #object_type_extension?, #object_value?, #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?, #variable_definition?

Constructor Details

#initialize(pos, type, name, variable_definitions, directives, selection_set) ⇒ OperationDefinition

Returns a new instance of OperationDefinition.



93
94
95
96
97
98
99
100
# File 'lib/tinygql/nodes.rb', line 93

def initialize pos, type, name, variable_definitions, directives, selection_set
  super(pos)
  @type = type
  @name = name
  @variable_definitions = variable_definitions
  @directives = directives
  @selection_set = selection_set
end

Instance Attribute Details

#directivesObject (readonly)

Returns the value of attribute directives.



91
92
93
# File 'lib/tinygql/nodes.rb', line 91

def directives
  @directives
end

#nameObject (readonly)

Returns the value of attribute name.



91
92
93
# File 'lib/tinygql/nodes.rb', line 91

def name
  @name
end

#selection_setObject (readonly)

Returns the value of attribute selection_set.



91
92
93
# File 'lib/tinygql/nodes.rb', line 91

def selection_set
  @selection_set
end

#typeObject (readonly)

Returns the value of attribute type.



91
92
93
# File 'lib/tinygql/nodes.rb', line 91

def type
  @type
end

#variable_definitionsObject (readonly)

Returns the value of attribute variable_definitions.



91
92
93
# File 'lib/tinygql/nodes.rb', line 91

def variable_definitions
  @variable_definitions
end

Instance Method Details

#accept(viz) ⇒ Object



102
103
104
# File 'lib/tinygql/nodes.rb', line 102

def accept viz
  viz.handle_operation_definition self
end

#childrenObject



112
113
114
# File 'lib/tinygql/nodes.rb', line 112

def children
  ary = []; ary.concat(variable_definitions) if variable_definitions; ary.concat(directives) if directives; ary.concat(selection_set); ary
end

#fold(viz, seed) ⇒ Object



106
107
108
# File 'lib/tinygql/nodes.rb', line 106

def fold viz, seed
  viz.handle_operation_definition self, seed
end

#operation_definition?Boolean

Returns:

  • (Boolean)


110
# File 'lib/tinygql/nodes.rb', line 110

def operation_definition?; true; end