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

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/query/serial_execution/field_resolution.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(selection, parent_type, target, query_ctx) ⇒ FieldResolution

Returns a new instance of FieldResolution



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 8

def initialize(selection, parent_type, target, query_ctx)
  @irep_node = selection
  @selection = selection
  @parent_type = parent_type
  @target = target
  @query = query_ctx.query
  @field = irep_node.definition
  @field_ctx = query_ctx.spawn_child(
    key: irep_node.name,
    object: target,
    irep_node: irep_node,
  )
  @arguments = @query.arguments_for(irep_node, @field)
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments



6
7
8
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 6

def arguments
  @arguments
end

#fieldObject (readonly)

Returns the value of attribute field



6
7
8
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 6

def field
  @field
end

#irep_nodeObject (readonly)

Returns the value of attribute irep_node



6
7
8
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 6

def irep_node
  @irep_node
end

#parent_typeObject (readonly)

Returns the value of attribute parent_type



6
7
8
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 6

def parent_type
  @parent_type
end

#queryObject (readonly)

Returns the value of attribute query



6
7
8
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 6

def query
  @query
end

#targetObject (readonly)

Returns the value of attribute target



6
7
8
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 6

def target
  @target
end

Instance Method Details

#execution_contextObject

GraphQL::Batch depends on this



34
35
36
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 34

def execution_context
  @field_ctx
end

#resultObject



23
24
25
26
27
28
29
30
31
# File 'lib/graphql/query/serial_execution/field_resolution.rb', line 23

def result
  result_name = irep_node.name
  raw_value = get_raw_value
  if raw_value.is_a?(GraphQL::Execution::Execute::Skip)
    {}
  else
    { result_name => get_finished_value(raw_value) }
  end
end