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.


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

def initialize(arbitrary_hash)
  @arbitrary_hash = arbitrary_hash
end

Instance Method Details

#[](key) ⇒ Object


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

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