class Roda::RodaPlugins::Streaming::Stream

Class of the response body in case you use #stream.

def <<(data)

Add output to the streaming response body. Returns self.
def <<(data)
  write(data)
  self
end

def close

any callbacks.
If not already closed, close the connection, and call
def close
  return if closed?
  @closed = true
  @callback.call if @callback
end

def closed?

Whether the connection has already been closed.
def closed?
  @closed
end

def each(&out)

Yield values to the block as they are passed in via #<<.
def each(&out)
  @out = out
  @block.call(self)
ensure
  close
end

def initialize(opts=OPTS, &block)

Handle streaming options, see Streaming for details.
def initialize(opts=OPTS, &block)
  @block = block
  @out = nil
  @callback = opts[:callback]
  @closed = false
end

def write(data)

Add output to the streaming response body. Returns number of bytes written.
def write(data)
  data = data.to_s
  @out.call(data)
  data.bytesize
end