Class: GraphQL::Subscriptions::DefaultSubscriptionResolveExtension

Inherits:
SubscriptionRoot::Extension show all
Defined in:
lib/graphql/subscriptions/default_subscription_resolve_extension.rb

Instance Attribute Summary

Attributes inherited from GraphQL::Schema::FieldExtension

#field, #options

Instance Method Summary collapse

Methods inherited from SubscriptionRoot::Extension

#after_resolve

Methods inherited from GraphQL::Schema::FieldExtension

#after_resolve, #apply, #initialize

Constructor Details

This class inherits a constructor from GraphQL::Schema::FieldExtension

Instance Method Details

#resolve(context:, object:, arguments:) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/graphql/subscriptions/default_subscription_resolve_extension.rb', line 5

def resolve(context:, object:, arguments:)
  has_override_implementation = @field.resolver ||
    object.respond_to?(@field.resolver_method)

  if !has_override_implementation
    if context.query.subscription_update?
      object.object
    else
      context.skip
    end
  else
    yield(object, arguments)
  end
end