Class: Dry::Logic::Operations::Implication
- Inherits:
-
Binary
show all
- Defined in:
- lib/dry/logic/operations/implication.rb
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
29
30
31
32
33
34
35
|
# File 'lib/dry/logic/operations/implication.rb', line 29
def [](input)
if left[input]
right[input]
else
true
end
end
|
#call(input) ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/dry/logic/operations/implication.rb', line 18
def call(input)
left_result = left.(input)
if left_result.success?
right_result = right.(input)
Result.new(right_result.success?, id) { right_result.to_ast }
else
Result::SUCCESS
end
end
|
#operator ⇒ Object
14
15
16
|
# File 'lib/dry/logic/operations/implication.rb', line 14
def operator
:then
end
|
#type ⇒ Object
10
11
12
|
# File 'lib/dry/logic/operations/implication.rb', line 10
def type
:implication
end
|