Class: Dry::Logic::Operations::Or
Instance Attribute Summary
Attributes inherited from Binary
#left, #right
Attributes inherited from Abstract
#options, #rules
Instance Method Summary
collapse
Methods inherited from Binary
#ast, #initialize, #to_s
Methods inherited from Abstract
#curry, #id, #initialize, #new, #to_ast, #with
#and, #or, #then, #xor
Instance Method Details
#[](input) ⇒ Object
28
29
30
|
# File 'lib/dry/logic/operations/or.rb', line 28
def [](input)
left[input] || right[input]
end
|
#call(input) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/dry/logic/operations/or.rb', line 12
def call(input)
left_result = left.(input)
if left_result.success?
Result::SUCCESS
else
right_result = right.(input)
if right_result.success?
Result::SUCCESS
else
Result.new(false, id) { [:or, [left_result.to_ast, right_result.to_ast]] }
end
end
end
|
#type ⇒ Object
Also known as:
operator
7
8
9
|
# File 'lib/dry/logic/operations/or.rb', line 7
def type
:or
end
|