Class: GraphQL::Query::SerialExecution::FragmentSpreadResolution
- Inherits:
-
BaseExecution::SelectedObjectResolution
- Object
- BaseExecution::SelectedObjectResolution
- GraphQL::Query::SerialExecution::FragmentSpreadResolution
- Defined in:
- lib/graphql/query/serial_execution/fragment_spread_resolution.rb
Instance Attribute Summary collapse
-
#ast_fragment ⇒ Object
readonly
Returns the value of attribute ast_fragment.
-
#resolved_type ⇒ Object
readonly
Returns the value of attribute resolved_type.
Attributes inherited from BaseExecution::SelectedObjectResolution
#ast_node, #execution_strategy, #parent_type, #query, #target
Instance Method Summary collapse
-
#initialize(ast_node, type, target, query, execution_strategy) ⇒ FragmentSpreadResolution
constructor
A new instance of FragmentSpreadResolution.
- #result ⇒ Object
Constructor Details
#initialize(ast_node, type, target, query, execution_strategy) ⇒ FragmentSpreadResolution
Returns a new instance of FragmentSpreadResolution.
6 7 8 9 10 11 |
# File 'lib/graphql/query/serial_execution/fragment_spread_resolution.rb', line 6 def initialize(ast_node, type, target, query, execution_strategy) super @ast_fragment = query.fragments[ast_node.name] child_type = query.schema.types[ast_fragment.type] @resolved_type = GraphQL::Query::TypeResolver.new(target, child_type, type).type end |
Instance Attribute Details
#ast_fragment ⇒ Object (readonly)
Returns the value of attribute ast_fragment.
5 6 7 |
# File 'lib/graphql/query/serial_execution/fragment_spread_resolution.rb', line 5 def ast_fragment @ast_fragment end |
#resolved_type ⇒ Object (readonly)
Returns the value of attribute resolved_type.
5 6 7 |
# File 'lib/graphql/query/serial_execution/fragment_spread_resolution.rb', line 5 def resolved_type @resolved_type end |
Instance Method Details
#result ⇒ Object
13 14 15 16 17 18 |
# File 'lib/graphql/query/serial_execution/fragment_spread_resolution.rb', line 13 def result return {} if resolved_type.nil? selections = ast_fragment.selections resolver = execution_strategy.selection_resolution.new(target, resolved_type, selections, query, execution_strategy) resolver.result end |