Sha256: 4f1a2455be47c6b93d1e8c1b82c8b558197f7173c1037011ae92265315b526bd

Contents?: true

Size: 259 Bytes

Versions: 2

Compression:

Stored size: 259 Bytes

Contents

module Frappuccino
  class Scan < Stream
    def initialize(source, zero, &blk)
      @last = zero
      @block = blk

      source.add_observer(self)
    end

    def update(value)
      @last = @block.call(@last, value)
      occur(@last)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frappuccino-0.3.0 lib/frappuccino/stream/scan.rb
frappuccino-0.2.0 lib/frappuccino/stream/scan.rb