Class: TinyGQL::Nodes::FragmentDefinition

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

Instance Attribute Summary collapse

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_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?, #variable_definition?

Constructor Details

#initialize(fragment_name, type_condition, directives, selection_set) ⇒ FragmentDefinition

Returns a new instance of FragmentDefinition.



502
503
504
505
506
507
# File 'lib/tinygql/nodes.rb', line 502

def initialize fragment_name, type_condition, directives, selection_set
  @fragment_name = fragment_name
  @type_condition = type_condition
  @directives = directives
  @selection_set = selection_set
end

Instance Attribute Details

#directivesObject (readonly)

Returns the value of attribute directives.



500
501
502
# File 'lib/tinygql/nodes.rb', line 500

def directives
  @directives
end

#fragment_nameObject (readonly)

Returns the value of attribute fragment_name.



500
501
502
# File 'lib/tinygql/nodes.rb', line 500

def fragment_name
  @fragment_name
end

#selection_setObject (readonly)

Returns the value of attribute selection_set.



500
501
502
# File 'lib/tinygql/nodes.rb', line 500

def selection_set
  @selection_set
end

#type_conditionObject (readonly)

Returns the value of attribute type_condition.



500
501
502
# File 'lib/tinygql/nodes.rb', line 500

def type_condition
  @type_condition
end

Instance Method Details

#accept(viz) ⇒ Object



509
510
511
# File 'lib/tinygql/nodes.rb', line 509

def accept viz
  viz.handle_fragment_definition self
end

#childrenObject



519
520
521
# File 'lib/tinygql/nodes.rb', line 519

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

#fold(viz, seed) ⇒ Object



513
514
515
# File 'lib/tinygql/nodes.rb', line 513

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

#fragment_definition?Boolean

Returns:

  • (Boolean)


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

def fragment_definition?; true; end