Class: DoRole::ConditionsProxy
- Inherits:
-
Object
- Object
- DoRole::ConditionsProxy
- Defined in:
- lib/do_role/conditions_proxy.rb
Instance Attribute Summary collapse
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
Instance Method Summary collapse
- #condition(name, value) ⇒ Object
-
#initialize(conditions) ⇒ ConditionsProxy
constructor
A new instance of ConditionsProxy.
- #requires(*permissions) ⇒ Object
Constructor Details
#initialize(conditions) ⇒ ConditionsProxy
Returns a new instance of ConditionsProxy.
6 7 8 |
# File 'lib/do_role/conditions_proxy.rb', line 6 def initialize(conditions) @conditions = conditions end |
Instance Attribute Details
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
5 6 7 |
# File 'lib/do_role/conditions_proxy.rb', line 5 def conditions @conditions end |
Instance Method Details
#condition(name, value) ⇒ Object
10 11 12 |
# File 'lib/do_role/conditions_proxy.rb', line 10 def condition(name, value) @conditions[name.to_sym] = value end |
#requires(*permissions) ⇒ Object
14 15 16 |
# File 'lib/do_role/conditions_proxy.rb', line 14 def requires(*) @conditions[:requires] = .flatten.map(&:to_s) end |