Class: GraphQL::Query::Arguments
- Inherits:
-
Object
- Object
- GraphQL::Query::Arguments
- Extended by:
- Forwardable
- Defined in:
- lib/graphql/query/arguments.rb
Overview
Instance Method Summary collapse
-
#[](key) ⇒ Object
The argument at that key.
-
#initialize(values) ⇒ Arguments
constructor
A new instance of Arguments.
-
#key?(key) ⇒ Boolean
True if the argument was present in this field.
-
#to_h ⇒ Hash
Get the original Ruby hash.
Constructor Details
#initialize(values) ⇒ Arguments
Returns a new instance of Arguments.
9 10 11 12 13 14 15 |
# File 'lib/graphql/query/arguments.rb', line 9 def initialize(values) @original_values = values @argument_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.
19 20 21 |
# File 'lib/graphql/query/arguments.rb', line 19 def [](key) @argument_values[key.to_s] end |
#key?(key) ⇒ Boolean
Returns true if the argument was present in this field.
25 26 27 |
# File 'lib/graphql/query/arguments.rb', line 25 def key?(key) @argument_values.key?(key.to_s) end |
#to_h ⇒ Hash
Get the original Ruby hash
31 32 33 |
# File 'lib/graphql/query/arguments.rb', line 31 def to_h @unwrapped_values ||= unwrap_value(@original_values) end |