Class: GraphQL::Client::DocumentTypes::AnalyzeTypesVisitor

Inherits:
Language::Visitor
  • Object
show all
Includes:
TypeStack
Defined in:
lib/graphql/client/document_types.rb

Instance Attribute Summary collapse

Attributes included from TypeStack

#argument_definitions, #directive_definitions, #field_definitions, #object_types, #path, #schema

Instance Method Summary collapse

Methods included from TypeStack

#on_argument, #on_directive, #on_fragment_spread

Constructor Details

#initialize(*a, **kw) ⇒ AnalyzeTypesVisitor

Returns a new instance of AnalyzeTypesVisitor.



13
14
15
16
# File 'lib/graphql/client/document_types.rb', line 13

def initialize(*a, **kw)
  @fields = {}
  super
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



11
12
13
# File 'lib/graphql/client/document_types.rb', line 11

def fields
  @fields
end

Instance Method Details

#on_field(node, _parent) ⇒ Object



33
34
35
36
# File 'lib/graphql/client/document_types.rb', line 33

def on_field(node, _parent)
  @fields[node] = @field_definitions.last.type
  super
end

#on_fragment_definition(node, _parent) ⇒ Object



23
24
25
26
# File 'lib/graphql/client/document_types.rb', line 23

def on_fragment_definition(node, _parent)
  @fields[node] = @object_types.last
  super
end

#on_inline_fragment(node, _parent) ⇒ Object



28
29
30
31
# File 'lib/graphql/client/document_types.rb', line 28

def on_inline_fragment(node, _parent)
  @fields[node] = @object_types.last
  super
end

#on_operation_definition(node, _parent) ⇒ Object



18
19
20
21
# File 'lib/graphql/client/document_types.rb', line 18

def on_operation_definition(node, _parent)
  @fields[node] = @object_types.last
  super
end