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


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

def initialize(hash_key)
  @hash_key = hash_key
end

Instance Method Details

#call(obj, args, ctx) ⇒ Object


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

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