Class: GraphQL::Query::SerialExecution::FieldResolution
- Inherits:
-
Object
- Object
- GraphQL::Query::SerialExecution::FieldResolution
- Defined in:
- lib/graphql/query/serial_execution/field_resolution.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#execution_context ⇒ Object
readonly
Returns the value of attribute execution_context.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#irep_node ⇒ Object
readonly
Returns the value of attribute irep_node.
-
#parent_type ⇒ Object
readonly
Returns the value of attribute parent_type.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(irep_node, parent_type, target, execution_context) ⇒ FieldResolution
constructor
A new instance of FieldResolution.
- #result ⇒ Object
Constructor Details
#initialize(irep_node, parent_type, target, execution_context) ⇒ FieldResolution
Returns a new instance of FieldResolution.
7 8 9 10 11 12 13 14 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 7 def initialize(irep_node, parent_type, target, execution_context) @irep_node = irep_node @parent_type = parent_type @target = target @execution_context = execution_context @field = execution_context.get_field(parent_type, irep_node) @arguments = execution_context.query.arguments_for(irep_node, @field) end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
5 6 7 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 5 def arguments @arguments end |
#execution_context ⇒ Object (readonly)
Returns the value of attribute execution_context.
5 6 7 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 5 def execution_context @execution_context end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
5 6 7 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 5 def field @field end |
#irep_node ⇒ Object (readonly)
Returns the value of attribute irep_node.
5 6 7 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 5 def irep_node @irep_node end |
#parent_type ⇒ Object (readonly)
Returns the value of attribute parent_type.
5 6 7 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 5 def parent_type @parent_type end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
5 6 7 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 5 def target @target end |
Instance Method Details
#result ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 16 def result result_name = irep_node.name begin raw_value = get_raw_value { result_name => get_finished_value(raw_value) } rescue GraphQL::InvalidNullError => err if field.type.kind.non_null? raise(err) else err.parent_error? || execution_context.add_error(err) {result_name => nil} end end end |