Class: GraphQL::Query::SerialExecution::FieldResolution

Inherits:
BaseExecution::SelectedObjectResolution show all
Defined in:
lib/graphql/query/serial_execution/field_resolution.rb

Instance Attribute Summary collapse

Attributes inherited from BaseExecution::SelectedObjectResolution

#ast_node, #execution_strategy, #parent_type, #query, #target

Instance Method Summary collapse

Constructor Details

#initialize(ast_node, parent_type, target, query, execution_strategy) ⇒ FieldResolution

Returns a new instance of FieldResolution.


7
8
9
10
11
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 7

def initialize(ast_node, parent_type, target, query, execution_strategy)
  super
  @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::Arguments.new(ast_node.arguments, field.arguments, query.variables)
end

Instance Attribute Details

#argumentsObject (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

#fieldObject (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

Instance Method Details

#resultObject


13
14
15
16
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 13

def result
  result_name = ast_node.alias || ast_node.name
  { result_name => result_value}
end