Class: MicroMIDI::Instructions::Output
- Inherits:
-
Object
- Object
- MicroMIDI::Instructions::Output
- Defined in:
- lib/micromidi/instructions/output.rb,
lib/micromidi/instructions/shorthand.rb
Instance Method Summary collapse
-
#auto_output(mode = nil) ⇒ Object
toggle mode where messages are automatically outputted.
-
#initialize(state) ⇒ Output
constructor
A new instance of Output.
- #output(msg) ⇒ Object (also: #out)
Constructor Details
#initialize(state) ⇒ Output
Returns a new instance of Output.
9 10 11 |
# File 'lib/micromidi/instructions/output.rb', line 9 def initialize(state) @state = state end |
Instance Method Details
#auto_output(mode = nil) ⇒ Object
toggle mode where messages are automatically outputted
20 21 22 |
# File 'lib/micromidi/instructions/output.rb', line 20 def auto_output(mode = nil) mode.nil? ? @state.toggle_auto_output : @state.auto_output = mode end |
#output(msg) ⇒ Object Also known as: out
13 14 15 16 17 |
# File 'lib/micromidi/instructions/output.rb', line 13 def output(msg) auto_output(msg) if msg === false || msg === true @state.outputs.each { |o| o.puts(msg) } unless msg.nil? msg end |