class Marso::FiberProjection

Public Class Methods

new(process, source={}) click to toggle source
# File lib/marso/toolbelt/fiberpiping.rb, line 109
def initialize(process, source={})
  @src = source
  @process = process

  @fiber_delegate = Fiber.new do
    output = nil
    while input = Fiber.yield(output)
      output = process.call(input)
    end
  end

  @fiber_delegate.resume
end

Public Instance Methods

source(other_source) click to toggle source
# File lib/marso/toolbelt/fiberpiping.rb, line 123
def source(other_source)
  FiberProjection.new(@process, other_source)
end