class Roda::RodaPlugins::Streaming::Stream

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

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.
def write(data)
  @out.call(data.to_s)
  self
end