Class: Dry::Logic::Operations::Xor
Instance Attribute Summary
Attributes inherited from Binary
#left, #right
Attributes inherited from Abstract
#options, #rules
Instance Method Summary
collapse
Methods inherited from Binary
#initialize, #to_s
Methods inherited from Abstract
#curry, #id, #initialize, #new, #to_ast, #with
#and, #or, #then, #xor
Instance Method Details
#[](input) ⇒ Object
16
17
18
|
# File 'lib/dry/logic/operations/xor.rb', line 16
def [](input)
left[input] ^ right[input]
end
|
#ast(input = Undefined) ⇒ Object
20
21
22
|
# File 'lib/dry/logic/operations/xor.rb', line 20
def ast(input = Undefined)
[type, rules.map { |rule| rule.ast(input) }]
end
|
#call(input) ⇒ Object
12
13
14
|
# File 'lib/dry/logic/operations/xor.rb', line 12
def call(input)
Result.new(self[input], id) { ast(input) }
end
|
#type ⇒ Object
Also known as:
operator
7
8
9
|
# File 'lib/dry/logic/operations/xor.rb', line 7
def type
:xor
end
|