Class: MicroMIDI::Instructions::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/micromidi/instructions/output.rb,
lib/micromidi/instructions/shorthand.rb

Instance Method Summary collapse

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