Class: Cannie::Rule
- Inherits:
-
Object
- Object
- Cannie::Rule
- Defined in:
- lib/cannie/rule.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #applies_to?(permissions) ⇒ Boolean
-
#initialize(action, subject, options = {}) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(action, subject, options = {}) ⇒ Rule
Returns a new instance of Rule.
5 6 7 |
# File 'lib/cannie/rule.rb', line 5 def initialize(action, subject, ={}) @action, @subject, @_if, @_unless = action, subject, *.values_at(:if, :unless) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
3 4 5 |
# File 'lib/cannie/rule.rb', line 3 def action @action end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
3 4 5 |
# File 'lib/cannie/rule.rb', line 3 def subject @subject end |
Instance Method Details
#applies_to?(permissions) ⇒ Boolean
9 10 11 |
# File 'lib/cannie/rule.rb', line 9 def applies_to?() if?() && unless?() end |