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.
-
#allow_if ⇒ Object
Returns the value of attribute allow_if.
Instance Method Summary collapse
- #concerning?(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 10 |
# File 'lib/restrict/restriction.rb', line 5 def initialize(*args) = args. @allow_if = [:allow_if] @actions = args actions.empty? and raise ArgumentError, "expected actions to restrict, but got #{actions.inspect}" 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 |
#allow_if ⇒ Object
Returns the value of attribute allow_if.
3 4 5 |
# File 'lib/restrict/restriction.rb', line 3 def allow_if @allow_if end |
Instance Method Details
#concerning?(action) ⇒ Boolean
12 13 14 |
# File 'lib/restrict/restriction.rb', line 12 def concerning?(action) concerns_action?(action) || concerns_all? end |