Sha256: 69b5c835afbed2f7550a58b2e4f3d89750e0b24907d797bf23824f571cfe69e2

Contents?: true

Size: 958 Bytes

Versions: 3

Compression:

Stored size: 958 Bytes

Contents

# frozen_string_literal: true
# test_via: ../query.rb
module GraphQL
  class Query
    module ArgumentsCache
      # @return [Hash<InternalRepresentation::Node, GraphQL::Language::NodesDirectiveNode => Hash<GraphQL::Field, GraphQL::Directive => GraphQL::Query::Arguments>>]
      def self.build(query)
        Hash.new do |h1, irep_or_ast_node|
          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
            h2[definition] = if definition.arguments.none?
              GraphQL::Query::Arguments::NO_ARGS
            else
              GraphQL::Query::LiteralInput.from_arguments(
                ast_arguments,
                definition.arguments,
                query.variables,
              )
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphql-1.7.0 lib/graphql/query/arguments_cache.rb
graphql-1.6.8 lib/graphql/query/arguments_cache.rb
graphql-1.6.7 lib/graphql/query/arguments_cache.rb