Class: GraphQL::Execution::Interpreter::ArgumentsCache
- Inherits:
-
Object
- Object
- GraphQL::Execution::Interpreter::ArgumentsCache
- Defined in:
- lib/graphql/execution/interpreter/arguments_cache.rb
Instance Method Summary collapse
-
#fetch(ast_node, argument_owner, parent_object) ⇒ Object
-
#initialize(query) ⇒ ArgumentsCache
constructor
A new instance of ArgumentsCache.
Constructor Details
#initialize(query) ⇒ ArgumentsCache
Returns a new instance of ArgumentsCache.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/graphql/execution/interpreter/arguments_cache.rb', line 7 def initialize(query) @query = query @storage = Hash.new do |h, ast_node| h[ast_node] = Hash.new do |h2, arg_owner| h2[arg_owner] = Hash.new do |h3, parent_object| # First, normalize all AST or Ruby values to a plain Ruby hash args_hash = prepare_args_hash(ast_node) # Then call into the schema to coerce those incoming values arg_owner.coerce_arguments(parent_object, args_hash, query.context) end end end end |
Instance Method Details
#fetch(ast_node, argument_owner, parent_object) ⇒ Object
21 22 23 |
# File 'lib/graphql/execution/interpreter/arguments_cache.rb', line 21 def fetch(ast_node, argument_owner, parent_object) @storage[ast_node][argument_owner][parent_object] end |