class GraphQL::Pundit::Instrumenter

Intrumenter combining the authorization and scope instrumenters

Attributes

after_scope_instrumenter[R]
authorization_instrumenter[R]
before_scope_instrumenter[R]
current_user[R]

Public Class Methods

new(current_user = :current_user) click to toggle source
# File lib/graphql-pundit/instrumenter.rb, line 17
def initialize(current_user = :current_user)
  @current_user = current_user
  @authorization_instrumenter =
    Instrumenters::Authorization.new(current_user)
  @before_scope_instrumenter =
    Instrumenters::BeforeScope.new(current_user)
  @after_scope_instrumenter = Instrumenters::AfterScope.new(current_user)
end

Public Instance Methods

instrument(type, field) click to toggle source
# File lib/graphql-pundit/instrumenter.rb, line 26
def instrument(type, field)
  before_scoped_field = before_scope_instrumenter.instrument(type, field)
  after_scoped_field = after_scope_instrumenter
    .instrument(type, before_scoped_field)
  authorization_instrumenter.instrument(type, after_scoped_field)
end