Class: GraphQL::Field::Resolve::NameResolve

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

Overview

Call the field's name at query-time since it might have changed

Instance Method Summary collapse

Constructor Details

#initialize(field) ⇒ NameResolve

Returns a new instance of NameResolve


48
49
50
# File 'lib/graphql/field/resolve.rb', line 48

def initialize(field)
  @field = field
end

Instance Method Details

#call(obj, args, ctx) ⇒ Object


52
53
54
# File 'lib/graphql/field/resolve.rb', line 52

def call(obj, args, ctx)
  obj.public_send(@field.name)
end