Class: GraphQL::Query::FieldResolutionStrategy::ListResolutionStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/graph_ql/query/field_resolution_strategy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, field_type, target, parent_type, ast_field, operation_resolver) ⇒ ListResolutionStrategy

Returns a new instance of ListResolutionStrategy.



41
42
43
44
45
46
47
48
49
# File 'lib/graph_ql/query/field_resolution_strategy.rb', line 41

def initialize(value, field_type, target, parent_type, ast_field, operation_resolver)
  wrapped_type = field_type.of_type
  @result = value.map do |item|
    resolved_type = wrapped_type.kind.resolve(wrapped_type, item)
    strategy_class = GraphQL::Query::FieldResolutionStrategy.get_strategy_for_kind(resolved_type.kind)
    inner_strategy = strategy_class.new(item, resolved_type, target, parent_type, ast_field, operation_resolver)
    inner_strategy.result
  end
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



40
41
42
# File 'lib/graph_ql/query/field_resolution_strategy.rb', line 40

def result
  @result
end