Class: Circuits::Terminal::Input
- Inherits:
-
Object
- Object
- Circuits::Terminal::Input
- Defined in:
- lib/circuits/terminal/input.rb
Overview
Reads from a single output
Instance Method Summary collapse
-
#get ⇒ Boolean
Forward get to the output.
-
#initialize(opts = {}) ⇒ Input
constructor
Creates the input.
-
#set(output) ⇒ Object
Output to use or state to make a dummy output with.
Constructor Details
#initialize(opts = {}) ⇒ Input
Creates the input
11 12 13 |
# File 'lib/circuits/terminal/input.rb', line 11 def initialize(opts = {}) @terminal = opts[:terminal] || Output.new(state: opts[:state]) end |
Instance Method Details
#get ⇒ Boolean
Forward get to the output
17 18 19 |
# File 'lib/circuits/terminal/input.rb', line 17 def get @terminal.get end |
#set(output) ⇒ Object
Output to use or state to make a dummy output with
23 24 25 26 27 28 29 |
# File 'lib/circuits/terminal/input.rb', line 23 def set(output) if [Input, Output].include? output.class @terminal = output else @terminal = Output.new(state: output) end end |