class GraphQL::Schema::BuildFromDefinition::Builder::FieldResolveMethods
Every field’s resolve methods share these procs. They use the method’s name to find the field.
Attributes
Field names by resolve method name
Resolve method names by field name
Public Class Methods
Source
# File lib/graphql/schema/build_from_definition.rb, line 795 def initialize @method_names = Hash.new { |h, field_name| h[field_name] = -"resolve_field_#{field_name}" } field_names = @field_names = {} @instance_method_proc = proc { |**args| #: self as GraphQL::Schema::Object owner = self.class field_instance = context.types.field(owner, field_names[__method__]) context.schema.definition_default_resolve.call(owner, field_instance, object, args, context) } @singleton_method_proc = proc { |objects, context, **args| field_instance = context.types.field(self, field_names[__method__]) objects.map do |object| context.schema.definition_default_resolve.call(self, field_instance, object, args, context) end } end