Class: GraphQL::Query::SerialExecution::ValueResolution::ListResolution

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

Instance Attribute Summary

Attributes inherited from BaseResolution

#execution_context, #field_type, #irep_node, #parent_type, #target, #value

Instance Method Summary collapse

Methods inherited from BaseResolution

#get_strategy_for_kind, #initialize, #result

Constructor Details

This class inherits a constructor from GraphQL::Query::SerialExecution::ValueResolution::BaseResolution

Instance Method Details

#non_null_resultObject

For each item in the list, Resolve it with the “wrapped” type of this list



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/graphql/query/serial_execution/value_resolution.rb', line 45

def non_null_result
  wrapped_type = field_type.of_type
  strategy_class = get_strategy_for_kind(wrapped_type.kind)
  result = value.each_with_index.map do |item, index|
    irep_node.index = index
    inner_strategy = strategy_class.new(item, wrapped_type, target, parent_type, irep_node, execution_context)
    inner_strategy.result
  end
  irep_node.index = nil
  result
end