Class: GraphQL::Groups::ResultTransformer

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/groups/result_transformer.rb

Instance Method Summary collapse

Instance Method Details

#run(query_results) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/graphql/groups/result_transformer.rb', line 6

def run(query_results)
  # Sort by key length so that deeper nested queries come later
  query_results
    .sort_by { |query_result| query_result.key.length }
    .each_with_object({}) do |query_result, object|
    transform_result(query_result, object)
  end
end