Class: GraphQL::Query::SerialExecution::InlineFragmentResolution

Inherits:
BaseExecution::SelectedObjectResolution show all
Defined in:
lib/graphql/query/serial_execution/inline_fragment_resolution.rb

Instance Attribute Summary collapse

Attributes inherited from BaseExecution::SelectedObjectResolution

#ast_node, #execution_strategy, #parent_type, #query, #target

Instance Method Summary collapse

Constructor Details

#initialize(ast_node, type, target, query, execution_strategy) ⇒ InlineFragmentResolution

Returns a new instance of InlineFragmentResolution.



6
7
8
9
10
# File 'lib/graphql/query/serial_execution/inline_fragment_resolution.rb', line 6

def initialize(ast_node, type, target, query, execution_strategy)
  super
  child_type = query.schema.types[ast_node.type]
  @resolved_type = GraphQL::Query::TypeResolver.new(target, child_type, type).type
end

Instance Attribute Details

#resolved_typeObject (readonly)

Returns the value of attribute resolved_type.



5
6
7
# File 'lib/graphql/query/serial_execution/inline_fragment_resolution.rb', line 5

def resolved_type
  @resolved_type
end

Instance Method Details

#resultObject



12
13
14
15
16
17
# File 'lib/graphql/query/serial_execution/inline_fragment_resolution.rb', line 12

def result
  return {} if resolved_type.nil?
  selections = ast_node.selections
  resolver = execution_strategy.selection_resolution.new(target, resolved_type, selections, query, execution_strategy)
  resolver.result
end