Class: GraphQL::Query::Arguments
- Inherits:
-
Object
- Object
- GraphQL::Query::Arguments
- Extended by:
- Forwardable
- Defined in:
- lib/graphql/query/arguments.rb
Overview
Provide read-only access to arguments by string or symbol names.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(ast_arguments, argument_hash, variables) ⇒ Arguments
constructor
A new instance of Arguments.
Constructor Details
#initialize(ast_arguments, argument_hash, variables) ⇒ Arguments
Returns a new instance of Arguments.
7 8 9 10 11 12 13 14 |
# File 'lib/graphql/query/arguments.rb', line 7 def initialize(ast_arguments, argument_hash, variables) @hash = ast_arguments.reduce({}) do |memo, arg| arg_defn = argument_hash[arg.name] value = reduce_value(arg.value, arg_defn, variables) memo[arg.name] = value memo end end |
Instance Method Details
#[](key) ⇒ Object
18 19 20 |
# File 'lib/graphql/query/arguments.rb', line 18 def [](key) @hash[key.to_s] end |