Class: Policier::ConditionUnion
- Inherits:
-
Object
- Object
- Policier::ConditionUnion
- Defined in:
- lib/policier/condition_union.rb
Instance Attribute Summary collapse
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(*conditions) ⇒ ConditionUnion
constructor
A new instance of ConditionUnion.
- #payload ⇒ Object
- #union ⇒ Object
- #|(other) ⇒ Object
Constructor Details
#initialize(*conditions) ⇒ ConditionUnion
Returns a new instance of ConditionUnion.
7 8 9 10 11 |
# File 'lib/policier/condition_union.rb', line 7 def initialize(*conditions) @context = Context.current @conditions = [] conditions.each { |c| self | c } end |
Instance Attribute Details
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
5 6 7 |
# File 'lib/policier/condition_union.rb', line 5 def conditions @conditions end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/policier/condition_union.rb', line 5 def context @context end |
Instance Method Details
#payload ⇒ Object
23 24 25 |
# File 'lib/policier/condition_union.rb', line 23 def payload @context.payload end |
#union ⇒ Object
19 20 21 |
# File 'lib/policier/condition_union.rb', line 19 def union self end |
#|(other) ⇒ Object
13 14 15 16 17 |
# File 'lib/policier/condition_union.rb', line 13 def |(other) other = other.resolve if other.is_a?(Class) @conditions << other self end |