Class: Webmidi::Middleware::Filter
- Defined in:
- lib/webmidi/middleware/filter.rb
Instance Method Summary collapse
- #call(message) ⇒ Object
-
#initialize(app, channels: nil, types: nil, include_system: true, **options) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(app, channels: nil, types: nil, include_system: true, **options) ⇒ Filter
Returns a new instance of Filter.
6 7 8 9 10 11 |
# File 'lib/webmidi/middleware/filter.rb', line 6 def initialize(app, channels: nil, types: nil, include_system: true, **) super(app, **) @channels = channels @types = types @include_system = include_system end |
Instance Method Details
#call(message) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/webmidi/middleware/filter.rb', line 13 def call() return nil if @channels && !.channel && !@include_system return nil if @channels && .channel && !@channels.include?(.channel) return nil if @types && !@types.any? { |t| .is_a?(t) } @app.call() end |