Class: Sand::PolicyFinder
- Inherits:
-
Object
- Object
- Sand::PolicyFinder
- Defined in:
- lib/sand/policy_finder.rb
Constant Summary collapse
- POLICY_SUFFIX =
'Policy'.freeze
Instance Method Summary collapse
-
#initialize(object) ⇒ PolicyFinder
constructor
A new instance of PolicyFinder.
- #policy! ⇒ Object
- #scope! ⇒ Object
Constructor Details
#initialize(object) ⇒ PolicyFinder
Returns a new instance of PolicyFinder.
5 6 7 |
# File 'lib/sand/policy_finder.rb', line 5 def initialize(object) @object = object end |
Instance Method Details
#policy! ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/sand/policy_finder.rb', line 15 def policy! klass = find klass = Util.constantize(klass) if klass.is_a?(String) klass rescue NameError raise NotDefinedError end |
#scope! ⇒ Object
9 10 11 12 13 |
# File 'lib/sand/policy_finder.rb', line 9 def scope! policy!::Scope rescue NameError raise NotDefinedError end |