Class: GraphQL::Query::Context

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

Overview

Expose some query-specific info to field resolve functions. It delegates ‘[]` to the hash that’s passed to ‘GraphQL::Query#initialize`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values:) ⇒ Context

Returns a new instance of Context.



56
57
58
# File 'lib/graphql/query.rb', line 56

def initialize(values:)
  @values = values
end

Instance Attribute Details

#ast_nodeObject

Returns the value of attribute ast_node.



55
56
57
# File 'lib/graphql/query.rb', line 55

def ast_node
  @ast_node
end

#execution_strategyObject

Returns the value of attribute execution_strategy.



55
56
57
# File 'lib/graphql/query.rb', line 55

def execution_strategy
  @execution_strategy
end

Instance Method Details

#[](key) ⇒ Object



60
61
62
# File 'lib/graphql/query.rb', line 60

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

#async(&block) ⇒ Object



64
65
66
# File 'lib/graphql/query.rb', line 64

def async(&block)
  execution_strategy.async(block)
end