Class: Dry::Logic::Operations::Xor

Inherits:
Binary show all
Defined in:
lib/dry/logic/operations/xor.rb

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

Methods included from Dry::Logic::Operators

#and, #or, #then, #xor

Constructor Details

This class inherits a constructor from Dry::Logic::Operations::Binary

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

#typeObject Also known as: operator



7
8
9
# File 'lib/dry/logic/operations/xor.rb', line 7

def type
  :xor
end