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


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

def initialize(field)
  @field = field
end

Instance Method Details

#call(obj, args, ctx) ⇒ Object


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

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