Class: Dry::Logic::Rule::Composite

Inherits:
Dry::Logic::Rule show all
Defined in:
lib/dry/logic/rule/composite.rb

Instance Attribute Summary collapse

Attributes inherited from Dry::Logic::Rule

#predicate

Instance Method Summary collapse

Methods inherited from Dry::Logic::Rule

#and, #call, #curry, #negation, #new, #or, #predicate_id, #then, #type, #xor

Constructor Details

#initialize(left, right) ⇒ Composite



8
9
10
11
# File 'lib/dry/logic/rule/composite.rb', line 8

def initialize(left, right)
  @left = left
  @right = right
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



6
7
8
# File 'lib/dry/logic/rule/composite.rb', line 6

def left
  @left
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/dry/logic/rule/composite.rb', line 6

def name
  @name
end

#rightObject (readonly)

Returns the value of attribute right.



6
7
8
# File 'lib/dry/logic/rule/composite.rb', line 6

def right
  @right
end

Instance Method Details

#to_aryObject Also known as: to_a



17
18
19
# File 'lib/dry/logic/rule/composite.rb', line 17

def to_ary
  [type, [left.to_ary, right.to_ary]]
end