Class: GraphQL::Schema::Traversal Private

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/schema/traversal.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Visit the members of this schema and build up artifacts for runtime.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema, introspection: true) ⇒ Traversal

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Traversal

Parameters:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/graphql/schema/traversal.rb', line 20

def initialize(schema, introspection: true)
  @schema = schema
  @introspection = introspection
  @field_instrumenters =
    schema.instrumenters[:field] +
      Schema::BUILT_IN_INSTRUMENTERS +
      schema.instrumenters[:field_after_built_ins]

  # These fields have types specified by _name_,
  # So we need to inspect the schema and find those types,
  # then update their references.
  @late_bound_fields = []
  @type_map = {}
  @instrumented_field_map = Hash.new { |h, k| h[k] = {} }
  @type_reference_map = Hash.new { |h, k| h[k] = [] }
  @union_memberships = Hash.new { |h, k| h[k] = [] }
  visit(schema, schema, nil)
  resolve_late_bound_fields
end

Instance Attribute Details

#instrumented_field_mapHash<String => Hash<String => GraphQL::Field>> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



11
12
13
# File 'lib/graphql/schema/traversal.rb', line 11

def instrumented_field_map
  @instrumented_field_map
end

#type_mapHash<String => GraphQL::BaseType] (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Hash<String => GraphQL::BaseType]

Returns:



8
9
10
# File 'lib/graphql/schema/traversal.rb', line 8

def type_map
  @type_map
end

#type_reference_mapHash<String => Array<GraphQL::Field || GraphQL::Argument || GraphQL::Directive>] (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Hash<String => Array<GraphQL::Field   GraphQL::Argument   GraphQL::Directive>]

Returns:



14
15
16
# File 'lib/graphql/schema/traversal.rb', line 14

def type_reference_map
  @type_reference_map
end

#union_membershipsHash<String => Array<GraphQL::BaseType>] (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Hash<String => Array]

Returns:



17
18
19
# File 'lib/graphql/schema/traversal.rb', line 17

def union_memberships
  @union_memberships
end