Class: GraphQL::Query::Arguments

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/graphql/query/arguments.rb

Overview

Read-only access to values, normalizing all keys to strings

Arguments recursively wraps the input in Arguments instances.

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ Arguments

Returns a new instance of Arguments.



9
10
11
12
13
14
# File 'lib/graphql/query/arguments.rb', line 9

def initialize(values)
  @values = values.inject({}) do |memo, (inner_key, inner_value)|
    memo[inner_key.to_s] = wrap_value(inner_value)
    memo
  end
end

Instance Method Details

#[](key) ⇒ Object

Returns the argument at that key.

Parameters:

  • name (String, Symbol)

    or index of value to access

Returns:

  • (Object)

    the argument at that key



18
19
20
# File 'lib/graphql/query/arguments.rb', line 18

def [](key)
  @values[key.to_s]
end