Class: Policier::ConditionUnion

Inherits:
Object
  • Object
show all
Defined in:
lib/policier/condition_union.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#conditionsObject (readonly)

Returns the value of attribute conditions.



5
6
7
# File 'lib/policier/condition_union.rb', line 5

def conditions
  @conditions
end

#contextObject (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

#payloadObject



23
24
25
# File 'lib/policier/condition_union.rb', line 23

def payload
  @context.payload
end

#unionObject



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