class Rack::Chunked::Body

A body wrapper that emits chunked responses

Constants

TAIL
TERM

Public Class Methods

new(body) click to toggle source
# File lib/rack/chunked.rb, line 19
def initialize(body)
  @body = body
end

Public Instance Methods

close() click to toggle source
# File lib/rack/chunked.rb, line 37
def close
  @body.close if @body.respond_to?(:close)
end
each() { |[size, term, chunk, term].join| ... } click to toggle source
# File lib/rack/chunked.rb, line 23
def each(&block)
  term = TERM
  @body.each do |chunk|
    size = chunk.bytesize
    next if size == 0

    chunk = chunk.b
    yield [size.to_s(16), term, chunk, term].join
  end
  yield TAIL
  insert_trailers(&block)
  yield TERM
end

Private Instance Methods

insert_trailers(&block) click to toggle source
# File lib/rack/chunked.rb, line 43
def insert_trailers(&block)
end