Class: GraphQL::Query::Arguments

Inherits:
Object
  • Object
show all
Defined in:
lib/graph_ql/query/arguments.rb

Overview

Creates a plain hash out of arguments, looking up variables if necessary

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ast_arguments, variables) ⇒ Arguments

Returns a new instance of Arguments.



4
5
6
7
8
9
10
# File 'lib/graph_ql/query/arguments.rb', line 4

def initialize(ast_arguments, variables)
  @to_h = ast_arguments.reduce({}) do |memo, arg|
    value = reduce_value(arg.value, variables)
    memo[arg.name] = value
    memo
  end
end

Instance Attribute Details

#to_hObject (readonly)

Returns the value of attribute to_h.



3
4
5
# File 'lib/graph_ql/query/arguments.rb', line 3

def to_h
  @to_h
end