Module: Boolean
- Included in:
- FalseClass, TrueClass
- Defined in:
- lib/logic_analyzer/boolean.rb
Instance Method Summary collapse
- #and(other) ⇒ Object
- #if_and_only_if(other) ⇒ Object (also: #<=>)
- #not(expression = nil) ⇒ Object
- #or(other) ⇒ Object
- #then(other) ⇒ Object (also: #>)
- #xor(other) ⇒ Object (also: #!=)
Instance Method Details
#and(other) ⇒ Object
2 3 4 |
# File 'lib/logic_analyzer/boolean.rb', line 2 def and(other) self && other end |
#if_and_only_if(other) ⇒ Object Also known as: <=>
18 19 20 |
# File 'lib/logic_analyzer/boolean.rb', line 18 def if_and_only_if(other) self.then(other) && other.then(self) end |
#not(expression = nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/logic_analyzer/boolean.rb', line 22 def not(expression = nil) if expression.nil? !self else !expression end end |
#or(other) ⇒ Object
6 7 8 |
# File 'lib/logic_analyzer/boolean.rb', line 6 def or(other) self || other end |
#then(other) ⇒ Object Also known as: >
14 15 16 |
# File 'lib/logic_analyzer/boolean.rb', line 14 def then(other) !self || other end |
#xor(other) ⇒ Object Also known as: !=
10 11 12 |
# File 'lib/logic_analyzer/boolean.rb', line 10 def xor(other) (self && !other) || (other && !self) end |