Class: Plumbing::Pipeline::Filter

Inherits:
Base show all
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

#worker

Instance Method Summary collapse

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