Sha256: be26cca71d41a3fcc6444fb24b8afdc275ee7a702397331f9721b1ac3af55636
Contents?: true
Size: 811 Bytes
Versions: 3
Compression:
Stored size: 811 Bytes
Contents
class GraphQL::Query::SelectionResolver attr_reader :result RESOLUTION_STRATEGIES = { GraphQL::Language::Nodes::Field => GraphQL::Query::FieldResolutionStrategy, GraphQL::Language::Nodes::FragmentSpread => GraphQL::Query::FragmentSpreadResolutionStrategy, GraphQL::Language::Nodes::InlineFragment => GraphQL::Query::InlineFragmentResolutionStrategy, } def initialize(target, type, selections, operation_resolver) @result = selections.reduce({}) do |memo, ast_field| chain = GraphQL::Query::DirectiveChain.new(ast_field, operation_resolver) { strategy_class = RESOLUTION_STRATEGIES[ast_field.class] strategy = strategy_class.new(ast_field, type, target, operation_resolver) strategy.result } memo.merge(chain.result) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
graphql-0.6.2 | lib/graphql/query/selection_resolver.rb |
graphql-0.6.1 | lib/graphql/query/selection_resolver.rb |
graphql-0.6.0 | lib/graphql/query/selection_resolver.rb |