Class: HasStrongPolicy::Policy
- Inherits:
-
Object
- Object
- HasStrongPolicy::Policy
- Defined in:
- lib/has_strong_policy/policy.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.inherited(base) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/has_strong_policy/policy.rb', line 2 def self.inherited(base) base.instance_eval do @policy_set = HasStrongPolicy::PolicySet.new def policy_set @policy_set end end end |
.policy(&block) ⇒ Object
12 13 14 |
# File 'lib/has_strong_policy/policy.rb', line 12 def self.policy(&block) policy_set.with_condition({},nil,&block) end |
Instance Method Details
#apply(params, options = {}) ⇒ Object
16 17 18 19 |
# File 'lib/has_strong_policy/policy.rb', line 16 def apply(params, = {}) conditions = build_conditions(params, ) self.class.policy_set.with_condition(conditions).apply(params, ) end |