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

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

Instance Method Summary collapse

Constructor Details

#initialize(object_class:, inner_resolve:) ⇒ PerFieldProxyResolve

Returns a new instance of PerFieldProxyResolve.



137
138
139
140
# File 'lib/graphql/schema/introspection_system.rb', line 137

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

Instance Method Details

#call(obj, args, ctx) ⇒ Object



142
143
144
145
146
147
148
149
150
# File 'lib/graphql/schema/introspection_system.rb', line 142

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.wrap(obj, query_ctx)
  @inner_resolve.call(wrapped_object, args, ctx)
end