Class: GraphQL::Schema::IntrospectionSystem::PerFieldProxyResolve Private

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/schema/introspection_system.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(object_class:, inner_resolve:) ⇒ PerFieldProxyResolve

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PerFieldProxyResolve



76
77
78
79
# File 'lib/graphql/schema/introspection_system.rb', line 76

def initialize(object_class:, inner_resolve:)
  @object_class = object_class
  @inner_resolve = inner_resolve
end

Instance Method Details

#call(obj, args, ctx) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



81
82
83
84
85
86
87
88
89
# File 'lib/graphql/schema/introspection_system.rb', line 81

def call(obj, args, ctx)
  query_ctx = ctx.query.context
  # Remove the QueryType wrapper
  if obj.is_a?(GraphQL::Schema::Object)
    obj = obj.object
  end
  wrapped_object = @object_class.new(obj, query_ctx)
  @inner_resolve.call(wrapped_object, args, ctx)
end