Module: UniMIDI::Loader
Overview
Populate UniMIDI devices using the underlying device objects from the platform-specific gems
Instance Method Summary collapse
- #devices(options = {}) ⇒ Array<Input>, Array<Output>
-
#use(loader) ⇒ Object
Use the given platform-specific adapter to load devices.
Instance Method Details
#devices(options = {}) ⇒ Array<Input>, Array<Output>
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/unimidi/loader.rb', line 17 def devices( = {}) if @devices.nil? inputs = @loader.inputs.map { |device| ::UniMIDI::Input.new(device) } outputs = @loader.outputs.map { |device| ::UniMIDI::Output.new(device) } @devices = { :input => inputs, :output => outputs } end [:direction].nil? ? @devices.values.flatten : @devices[[:direction]] end |
#use(loader) ⇒ Object
Use the given platform-specific adapter to load devices
10 11 12 |
# File 'lib/unimidi/loader.rb', line 10 def use(loader) @loader = loader end |