Class: ActiveEntry::PolicyFinder
- Inherits:
-
Object
- Object
- ActiveEntry::PolicyFinder
- Defined in:
- lib/active_entry/policy_finder.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(class_name) ⇒ PolicyFinder
constructor
A new instance of PolicyFinder.
- #policy ⇒ Object
Constructor Details
#initialize(class_name) ⇒ PolicyFinder
Returns a new instance of PolicyFinder.
5 6 7 |
# File 'lib/active_entry/policy_finder.rb', line 5 def initialize class_name @class_name = class_name end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
3 4 5 |
# File 'lib/active_entry/policy_finder.rb', line 3 def class_name @class_name end |
Class Method Details
.policy_for(class_name) ⇒ Object
10 11 12 |
# File 'lib/active_entry/policy_finder.rb', line 10 def policy_for class_name new(class_name).policy end |
Instance Method Details
#policy ⇒ Object
15 16 17 |
# File 'lib/active_entry/policy_finder.rb', line 15 def policy policy_class_name.safe_constantize or raise NotDefinedError.new(policy_class_name, @class_name) end |