Class: Plumbing::Pipeline::Filter
- Defined in:
- lib/plumbing/pipeline/filter.rb
Overview
Emits only the events whose type name matches one of the Regexp filters. The power-user form (Only/Except cover the common wildcard cases).
Constant Summary
Constants included from Actor
Actor::FIBER_KEY, Actor::NotSupported
Instance Attribute Summary
Attributes included from Actor
Instance Method Summary collapse
-
#initialize(source:, filters: []) ⇒ Filter
constructor
A new instance of Filter.
Methods inherited from Base
Methods included from Actor
#after, #cancel_deferred, #current_sender, #current_senders, included
Methods included from Actor::Configuration
#register, #selected_worker_type, #uses, #worker_for, #worker_types, #workers
Constructor Details
#initialize(source:, filters: []) ⇒ Filter
Returns a new instance of Filter.
10 11 12 13 14 |
# File 'lib/plumbing/pipeline/filter.rb', line 10 def initialize(source:, filters: []) super() list = Array(filters) chain(source) { |event| list.any? { |regexp| regexp.match?(event.class.name) } } end |