Class: Plumbing::Pipeline::Base

Inherits:
Object
  • Object
show all
Includes:
Actor
Defined in:
lib/plumbing/pipeline/base.rb

Overview

Abstract base for all pipelines. A pipeline is an actor, so its observer list and event queue are safe under the concurrent workers. Observers are procs, each called with every emitted event.

Direct Known Subclasses

Except, Filter, Junction, Only, Source

Constant Summary

Constants included from Actor

Actor::FIBER_KEY, Actor::NotSupported

Instance Attribute Summary

Attributes included from Actor

#worker

Instance Method Summary collapse

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

#initializeBase

Returns a new instance of Base.



14
15
16
17
18
19
20
# File 'lib/plumbing/pipeline/base.rb', line 14

def initialize
  super
  @observers = []
  @queue = []
  @seen = Set.new
  @draining = false
end

Instance Method Details

#<<(event) ⇒ Object

Emit an event (alias for #push). Returns the awaitable message.



71
# File 'lib/plumbing/pipeline/base.rb', line 71

def <<(event) = push(event: event)