Class: Restrict::Restriction
- Inherits:
-
Object
- Object
- Restrict::Restriction
- Defined in:
- lib/restrict/restriction.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#unless ⇒ Object
Returns the value of attribute unless.
Instance Method Summary collapse
- #applies_to?(action) ⇒ Boolean
-
#initialize(*args) ⇒ Restriction
constructor
A new instance of Restriction.
Constructor Details
#initialize(*args) ⇒ Restriction
Returns a new instance of Restriction.
5 6 7 8 9 |
# File 'lib/restrict/restriction.rb', line 5 def initialize(*args) = args. @unless = [:unless] @actions = args end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
3 4 5 |
# File 'lib/restrict/restriction.rb', line 3 def actions @actions end |
#unless ⇒ Object
Returns the value of attribute unless.
3 4 5 |
# File 'lib/restrict/restriction.rb', line 3 def unless @unless end |
Instance Method Details
#applies_to?(action) ⇒ Boolean
11 12 13 |
# File 'lib/restrict/restriction.rb', line 11 def applies_to?(action) applies_to_action?(action) || applies_to_all_actions? end |