Class: Vert::Authorization::PolicyFinder
- Inherits:
-
Object
- Object
- Vert::Authorization::PolicyFinder
- Defined in:
- lib/vert/authorization/policy_finder.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#initialize(object) ⇒ PolicyFinder
constructor
A new instance of PolicyFinder.
- #policy ⇒ Object
- #policy! ⇒ Object
- #scope ⇒ Object
- #scope! ⇒ Object
Constructor Details
#initialize(object) ⇒ PolicyFinder
Returns a new instance of PolicyFinder.
8 9 10 |
# File 'lib/vert/authorization/policy_finder.rb', line 8 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
6 7 8 |
# File 'lib/vert/authorization/policy_finder.rb', line 6 def object @object end |
Instance Method Details
#policy ⇒ Object
12 13 14 |
# File 'lib/vert/authorization/policy_finder.rb', line 12 def policy find_policy || DynamicPolicy end |
#policy! ⇒ Object
16 17 18 |
# File 'lib/vert/authorization/policy_finder.rb', line 16 def policy! policy || raise(Pundit::NotDefinedError, "Unable to find policy for #{object}") end |
#scope ⇒ Object
20 21 22 |
# File 'lib/vert/authorization/policy_finder.rb', line 20 def scope find_scope || DynamicPolicy::Scope end |
#scope! ⇒ Object
24 25 26 |
# File 'lib/vert/authorization/policy_finder.rb', line 24 def scope! scope || raise(Pundit::NotDefinedError, "Unable to find scope for #{object}") end |