Class: GraphQL::Query::SerialExecution::SelectionResolution
- Inherits:
-
Object
- Object
- GraphQL::Query::SerialExecution::SelectionResolution
- Defined in:
- lib/graphql/query/serial_execution/selection_resolution.rb
Instance Attribute Summary collapse
-
#execution_context ⇒ Object
readonly
Returns the value of attribute execution_context.
-
#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, execution_context) ⇒ SelectionResolution
constructor
A new instance of SelectionResolution.
- #result ⇒ Object
Constructor Details
#initialize(target, type, selections, execution_context) ⇒ SelectionResolution
Returns a new instance of SelectionResolution.
7 8 9 10 11 12 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 7 def initialize(target, type, selections, execution_context) @target = target @type = type @selections = selections @execution_context = execution_context end |
Instance Attribute Details
#execution_context ⇒ Object (readonly)
Returns the value of attribute execution_context.
5 6 7 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 5 def execution_context @execution_context 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
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/graphql/query/serial_execution/selection_resolution.rb', line 14 def result flatten_and_merge_selections(selections) .values .reduce({}) { |result, ast_node| result.merge(resolve_field(ast_node)) } rescue GraphQL::InvalidNullError => err err.parent_error? || execution_context.add_error(err) nil end |