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.



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

def initialize(hash_key)
  @hash_key = hash_key
end

Instance Method Details

#call(obj, args, ctx) ⇒ Object



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

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