Class: GraphQL::Pundit::Instrumenter
- Inherits:
-
Object
- Object
- GraphQL::Pundit::Instrumenter
- Defined in:
- lib/graphql-pundit/instrumenter.rb
Overview
Intrumenter combining the authorization and scope instrumenters
Instance Attribute Summary collapse
-
#after_scope_instrumenter ⇒ Object
readonly
Returns the value of attribute after_scope_instrumenter.
-
#authorization_instrumenter ⇒ Object
readonly
Returns the value of attribute authorization_instrumenter.
-
#before_scope_instrumenter ⇒ Object
readonly
Returns the value of attribute before_scope_instrumenter.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
Instance Method Summary collapse
-
#initialize(current_user = :current_user) ⇒ Instrumenter
constructor
A new instance of Instrumenter.
- #instrument(type, field) ⇒ Object
Constructor Details
#initialize(current_user = :current_user) ⇒ Instrumenter
Returns a new instance of Instrumenter.
17 18 19 20 21 22 23 24 |
# 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 |
Instance Attribute Details
#after_scope_instrumenter ⇒ Object (readonly)
Returns the value of attribute after_scope_instrumenter.
12 13 14 |
# File 'lib/graphql-pundit/instrumenter.rb', line 12 def after_scope_instrumenter @after_scope_instrumenter end |
#authorization_instrumenter ⇒ Object (readonly)
Returns the value of attribute authorization_instrumenter.
12 13 14 |
# File 'lib/graphql-pundit/instrumenter.rb', line 12 def @authorization_instrumenter end |
#before_scope_instrumenter ⇒ Object (readonly)
Returns the value of attribute before_scope_instrumenter.
12 13 14 |
# File 'lib/graphql-pundit/instrumenter.rb', line 12 def before_scope_instrumenter @before_scope_instrumenter end |
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
12 13 14 |
# File 'lib/graphql-pundit/instrumenter.rb', line 12 def current_user @current_user end |
Instance Method Details
#instrument(type, field) ⇒ Object
26 27 28 29 30 31 |
# 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) .instrument(type, after_scoped_field) end |