Class: GraphQL::Field::Resolve::HashKeyResolve

Inherits:
BuiltInResolve show all
Defined in:
lib/graphql/field/resolve.rb

Overview

Resolve the field by looking up @hash_key with #[]

Instance Method Summary collapse

Constructor Details

#initialize(hash_key) ⇒ HashKeyResolve

Returns a new instance of HashKeyResolve.



36
37
38
# File 'lib/graphql/field/resolve.rb', line 36

def initialize(hash_key)
  @hash_key = hash_key
end

Instance Method Details

#call(obj, args, ctx) ⇒ Object



40
41
42
# File 'lib/graphql/field/resolve.rb', line 40

def call(obj, args, ctx)
  obj[@hash_key]
end