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
Checks whether rule is applied to permissions passed as an argument.
-
#initialize(action, subject, options = {}) ⇒ Rule
constructor
Initializes new rule.
Constructor Details
#initialize(action, subject, options = {}) ⇒ Rule
Initializes new rule
14 15 16 |
# File 'lib/cannie/rule.rb', line 14 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
Checks whether rule is applied to permissions passed as an argument
22 23 24 |
# File 'lib/cannie/rule.rb', line 22 def applies_to?() if?() && unless?() end |