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.
-
#ast_node ⇒ Object
readonly
Returns the value of attribute ast_node.
-
#execution_strategy ⇒ Object
readonly
Returns the value of attribute execution_strategy.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#parent_type ⇒ Object
readonly
Returns the value of attribute parent_type.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(ast_node, parent_type, target, query, execution_strategy) ⇒ FieldResolution
constructor
A new instance of FieldResolution.
- #result ⇒ Object
Constructor Details
#initialize(ast_node, parent_type, target, query, execution_strategy) ⇒ FieldResolution
Returns a new instance of FieldResolution.
7 8 9 10 11 12 13 14 15 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 7 def initialize(ast_node, parent_type, target, query, execution_strategy) @ast_node = ast_node @parent_type = parent_type @target = target @query = query @execution_strategy = execution_strategy @field = query.schema.get_field(parent_type, ast_node.name) || raise("No field found on #{parent_type.name} '#{parent_type}' for '#{ast_node.name}'") @arguments = GraphQL::Query::LiteralInput.from_arguments(ast_node.arguments, field.arguments, query.variables) 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 |
#ast_node ⇒ Object (readonly)
Returns the value of attribute ast_node.
5 6 7 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 5 def ast_node @ast_node end |
#execution_strategy ⇒ Object (readonly)
Returns the value of attribute execution_strategy.
5 6 7 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 5 def execution_strategy @execution_strategy 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 |
#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 |
#query ⇒ Object (readonly)
Returns the value of attribute query.
5 6 7 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 5 def query @query 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
17 18 19 20 21 |
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 17 def result result_name = ast_node.alias || ast_node.name result_value = get_finished_value(get_raw_value) { result_name => result_value } end |