Class: GraphQL::Execution::Interpreter::Arguments

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Dig
Defined in:
lib/graphql/execution/interpreter/arguments.rb

Overview

A wrapper for argument hashes in GraphQL queries.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dig

#dig

Constructor Details

#initialize(keyword_arguments:, argument_values:) ⇒ Arguments

Returns a new instance of Arguments.



19
20
21
22
# File 'lib/graphql/execution/interpreter/arguments.rb', line 19

def initialize(keyword_arguments:, argument_values:)
  @keyword_arguments = keyword_arguments
  @argument_values = argument_values
end

Instance Attribute Details

#argument_valuesHash{Symbol => ArgumentValue} (readonly)

Returns:



30
31
32
# File 'lib/graphql/execution/interpreter/arguments.rb', line 30

def argument_values
  @argument_values
end

#keyword_argumentsHash<Symbol, Object> (readonly)

The Ruby-style arguments hash, ready for a resolver. This hash is the one used at runtime.

Returns:

  • (Hash<Symbol, Object>)


17
18
19
# File 'lib/graphql/execution/interpreter/arguments.rb', line 17

def keyword_arguments
  @keyword_arguments
end

Instance Method Details

#each_valueObject

Yields ArgumentValue instances which contain detailed metadata about each argument.



25
26
27
# File 'lib/graphql/execution/interpreter/arguments.rb', line 25

def each_value
  argument_values.each { |arg_v| yield(arg_v) }
end

#inspectObject



34
35
36
# File 'lib/graphql/execution/interpreter/arguments.rb', line 34

def inspect
  "#<#{self.class} @keyword_arguments=#{keyword_arguments.inspect}>"
end