Sha256: 24265daaf0cb953d57ff8ff230f16b4c76ec03d568709d1af0c68ffb87cda3f1

Contents?: true

Size: 305 Bytes

Versions: 6

Compression:

Stored size: 305 Bytes

Contents

class Stream
  def initialize(&callback)
    @callback = callback
    @closed = false
  end

  def close
    @closed = true
  end

  def each(&front)
    @front = front
    @callback.call(self)
    close
  end

  def <<(data)
    @front.call(data.to_s)
    self
  end

  def closed?
    @closed
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pubsubstub-0.3.0 lib/pubsubstub/stream.rb
pubsubstub-0.2.2 lib/pubsubstub/stream.rb
pubsubstub-0.2.1 lib/pubsubstub/stream.rb
pubsubstub-0.2.0 lib/pubsubstub/stream.rb
pubsubstub-0.1.3 lib/pubsubstub/stream.rb
pubsubstub-0.1.2 lib/pubsubstub/stream.rb