Class: Plumbing::Pipe::CustomFilter

Inherits:
Plumbing::Pipe show all
Defined in:
lib/plumbing/pipe/custom_filter.rb

Overview

A pipe that can be subclassed to filter events from a source pipe

Direct Known Subclasses

Filter

Instance Method Summary collapse

Methods inherited from Plumbing::Pipe

#add_observer, #is_observer?, #notify, #remove_observer, #shutdown

Methods included from Actor

#in_context?, included, #safely, #stop, timeout, transporter

Constructor Details

#initialize(source:) ⇒ CustomFilter

Chain this pipe to the source pipe

Parameters:



6
7
8
9
10
11
# File 'lib/plumbing/pipe/custom_filter.rb', line 6

def initialize source:
  super()
  source.as(Observable).add_observer do |event_name, data|
    received event_name, data
  end
end