Class: Webmidi::Middleware::SplitByChannel
- Defined in:
- lib/webmidi/middleware/split_by_channel.rb
Constant Summary collapse
- SYSTEM_ROUTE =
:system
Instance Method Summary collapse
- #call(message) ⇒ Object
-
#initialize(app, routes:, passthrough: false, **options) ⇒ SplitByChannel
constructor
A new instance of SplitByChannel.
Constructor Details
#initialize(app, routes:, passthrough: false, **options) ⇒ SplitByChannel
Returns a new instance of SplitByChannel.
8 9 10 11 12 |
# File 'lib/webmidi/middleware/split_by_channel.rb', line 8 def initialize(app, routes:, passthrough: false, **) super(app, **) @routes = normalize_routes(routes) @passthrough = passthrough end |
Instance Method Details
#call(message) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/webmidi/middleware/split_by_channel.rb', line 14 def call() targets = @routes[route_key()] return @app.call() unless targets targets.each { |target| deliver(target, ) } return @app.call() if @passthrough nil end |