class GraphQL::Schema::BuildFromDefinition::Builder::TypeResolver
Attributes
Directive applications waiting for {Builder#apply_queued_directives}
Public Class Methods
# File lib/graphql/schema/build_from_definition.rb, line 608 def initialize(lookup_hash, directives, queued_directives, &missing_type_handler) @lookup_hash = lookup_hash @directives = directives @queued_directives = queued_directives @missing_type_handler = missing_type_handler end
Public Instance Methods
Source
# File lib/graphql/schema/build_from_definition.rb, line 628 def call(ast_node) case ast_node when GraphQL::Language::Nodes::TypeName type_name = ast_node.name if @lookup_hash.key?(type_name) @lookup_hash[type_name] else @missing_type_handler.call(type_name) end when GraphQL::Language::Nodes::NonNullType call(ast_node.of_type).to_non_null_type when GraphQL::Language::Nodes::ListType call(ast_node.of_type).to_list_type when String @directives[ast_node] ||= @missing_type_handler.call(ast_node) else raise "Unexpected ast_node: #{ast_node.inspect}" end end
Source
# File lib/graphql/schema/build_from_definition.rb, line 624 def directive_class(name) @directives[name] end
The already-defined directive class named name, or nil if there isnβt one yet
Source
# File lib/graphql/schema/build_from_definition.rb, line 619 def register(type) @lookup_hash[type.graphql_name] = type end
Add type to the lookup hash. Types call this before building their members, so that references back to them (including cycles) find this type.