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 Method Summary collapse

Constructor Details

#initialize(arbitrary_hash) ⇒ Context

Returns a new instance of Context.



84
85
86
# File 'lib/graphql/query.rb', line 84

def initialize(arbitrary_hash)
  @arbitrary_hash = arbitrary_hash
end

Instance Method Details

#[](key) ⇒ Object



88
89
90
# File 'lib/graphql/query.rb', line 88

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