Class: Circuits::Terminal::Output
- Inherits:
-
Object
- Object
- Circuits::Terminal::Output
- Defined in:
- lib/circuits/terminal/output.rb
Overview
Belongs to a single component, gets set for reading by inputs
Instance Method Summary collapse
-
#get ⇒ TrueClass, FalseClass
Gets the state of the output.
-
#initialize(opts = {}) ⇒ Output
constructor
A new instance of Output.
-
#set(s) ⇒ Object
Saves the state.
-
#tock ⇒ Object
Sets the state to be the last state passed by #set.
Constructor Details
#initialize(opts = {}) ⇒ Output
Returns a new instance of Output.
7 8 9 10 |
# File 'lib/circuits/terminal/output.rb', line 7 def initialize(opts = {}) @next_state = opts[:state] || false @state = opts[:state] || false end |
Instance Method Details
#get ⇒ TrueClass, FalseClass
Gets the state of the output
14 15 16 |
# File 'lib/circuits/terminal/output.rb', line 14 def get state end |
#set(s) ⇒ Object
Saves the state
20 21 22 |
# File 'lib/circuits/terminal/output.rb', line 20 def set(s) @next_state = s end |
#tock ⇒ Object
Sets the state to be the last state passed by #set
25 26 27 |
# File 'lib/circuits/terminal/output.rb', line 25 def tock @state = next_state end |