Class: GraphQL::Pundit::Instrumenters::BeforeScope::ScopeResolver

Inherits:
ScopeResolver
  • Object
show all
Defined in:
lib/graphql-pundit/instrumenters/before_scope.rb

Overview

Applies the scoping to the passed object

Instance Method Summary collapse

Instance Method Details

#call(root, arguments, context) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/graphql-pundit/instrumenters/before_scope.rb', line 15

def call(root, arguments, context)
  if field.[:before_scope][:deprecated]
    Kernel.warn <<~DEPRECATION_WARNING
      Using `scope` is deprecated and might be removed in the future.
      Please use `before_scope` or `after_scope` instead.
    DEPRECATION_WARNING
  end
  scope_proc = new_scope(scope)
  resolver_result = scope_proc.call(root, arguments, context)
  old_resolver.call(resolver_result, arguments, context)
end