Module: GraphQL::Query::ArgumentsCache

Defined in:
lib/graphql/query/arguments_cache.rb

Class Method Summary collapse

Class Method Details

.build(query) ⇒ Hash<InternalRepresentation::Node, GraphQL::Language::NodesDirectiveNode => Hash<GraphQL::Field, GraphQL::Directive => GraphQL::Query::Arguments>>

Returns:



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/graphql/query/arguments_cache.rb', line 6

def self.build(query)
  Hash.new do |h1, irep_or_ast_node|
    Hash.new do |h2, definition|
      ast_node = irep_or_ast_node.is_a?(GraphQL::InternalRepresentation::Node) ? irep_or_ast_node.ast_node : irep_or_ast_node
      ast_arguments = ast_node.arguments
      GraphQL::Query::LiteralInput.from_arguments(
        ast_arguments,
        definition.arguments,
        query.variables,
      )
    end
  end
end