Class: Circuits::Component::Not

Inherits:
Base
  • Object
show all
Defined in:
lib/circuits/component/not.rb

Overview

Logical NOT Operator

Instance Attribute Summary

Attributes inherited from Base

#inputs, #outputs

Instance Method Summary collapse

Methods inherited from Base

#[], #tock

Constructor Details

#initializeNot

Returns a new instance of Not.



7
8
9
# File 'lib/circuits/component/not.rb', line 7

def initialize
  super(inputs: 1, outputs: 1)
end

Instance Method Details

#tickObject

Sets the output to be the result of a logical NOT of the inputs



12
13
14
# File 'lib/circuits/component/not.rb', line 12

def tick
  out.set(!self[:in].get)
end