Class: GraphQL::Field::Resolve::MethodResolve

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

Overview

Resolve the field by public_sending @method_name

Instance Method Summary collapse

Constructor Details

#initialize(field) ⇒ MethodResolve

Returns a new instance of MethodResolve.



26
27
28
# File 'lib/graphql/field/resolve.rb', line 26

def initialize(field)
  @method_name = field.property.to_sym
end

Instance Method Details

#call(obj, args, ctx) ⇒ Object



30
31
32
# File 'lib/graphql/field/resolve.rb', line 30

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