Class: GraphQL::Execution::Interpreter::Arguments
- Inherits:
-
Object
- Object
- GraphQL::Execution::Interpreter::Arguments
- Extended by:
- Forwardable
- Includes:
- Dig
- Defined in:
- lib/graphql/execution/interpreter/arguments.rb
Overview
A wrapper for argument hashes in GraphQL queries.
Instance Method Summary collapse
-
#argument_values ⇒ Hash{Symbol => ArgumentValue}
-
#empty? ⇒ Boolean
-
#initialize(argument_values:) ⇒ Arguments
constructor
A new instance of Arguments.
-
#inspect ⇒ Object
-
#keyword_arguments ⇒ Hash<Symbol, Object>
The Ruby-style arguments hash, ready for a resolver.
Methods included from Dig
Constructor Details
#initialize(argument_values:) ⇒ Arguments
Returns a new instance of Arguments.
28 29 30 31 |
# File 'lib/graphql/execution/interpreter/arguments.rb', line 28 def initialize(argument_values:) @argument_values = argument_values @empty = argument_values.nil? || argument_values.empty? end |
Instance Method Details
#argument_values ⇒ Hash{Symbol => ArgumentValue}
34 35 36 |
# File 'lib/graphql/execution/interpreter/arguments.rb', line 34 def argument_values @argument_values ||= {} end |
#empty? ⇒ Boolean
38 39 40 |
# File 'lib/graphql/execution/interpreter/arguments.rb', line 38 def empty? @empty end |
#inspect ⇒ Object
45 46 47 |
# File 'lib/graphql/execution/interpreter/arguments.rb', line 45 def inspect "#<#{self.class} @keyword_arguments=#{keyword_arguments.inspect}>" end |
#keyword_arguments ⇒ Hash<Symbol, Object>
The Ruby-style arguments hash, ready for a resolver. This hash is the one used at runtime.
17 18 19 20 21 22 23 24 25 |
# File 'lib/graphql/execution/interpreter/arguments.rb', line 17 def keyword_arguments @keyword_arguments ||= begin kwargs = {} argument_values.each do |name, arg_val| kwargs[name] = arg_val.value end kwargs end end |