Class: GraphQL::Query::SerialExecution::SelectionResolution
- Inherits:
-
Object
- Object
- GraphQL::Query::SerialExecution::SelectionResolution
- Defined in:
- lib/graphql/query/serial_execution/selection_resolution.rb
Constant Summary collapse
- RESOLUTION_STRATEGIES =
{ GraphQL::Language::Nodes::Field => :field_resolution, GraphQL::Language::Nodes::FragmentSpread => :fragment_spread_resolution, GraphQL::Language::Nodes::InlineFragment => :inline_fragment_resolution, }
Instance Attribute Summary collapse
-
#execution_strategy ⇒ Object
readonly
Returns the value of attribute execution_strategy.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#selections ⇒ Object
readonly
Returns the value of attribute selections.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(target, type, selections, query, execution_strategy) ⇒ SelectionResolution
constructor
A new instance of SelectionResolution.
- #result ⇒ Object
Constructor Details
#initialize(target, type, selections, query, execution_strategy) ⇒ SelectionResolution
Returns a new instance of SelectionResolution.
13 14 15 16 17 18 19 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 13 def initialize(target, type, selections, query, execution_strategy) @target = target @type = type @selections = selections @query = query @execution_strategy = execution_strategy end |
Instance Attribute Details
#execution_strategy ⇒ Object (readonly)
Returns the value of attribute execution_strategy.
5 6 7 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 5 def execution_strategy @execution_strategy end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
5 6 7 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 5 def query @query end |
#selections ⇒ Object (readonly)
Returns the value of attribute selections.
5 6 7 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 5 def selections @selections end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
5 6 7 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 5 def target @target end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 5 def type @type end |
Instance Method Details
#result ⇒ Object
21 22 23 24 25 26 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 21 def result selections.reduce({}) do |memo, ast_field| field_value = resolve_field(ast_field) deep_merge memo, field_value end end |