class Rack::Deflater::DeflateStream

Constants

DEFLATE_ARGS

Public Class Methods

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

Public Instance Methods

each() { |deflate(part, SYNC_FLUSH)| ... } click to toggle source
# File lib/rack/deflater.rb, line 92
def each
  deflater = ::Zlib::Deflate.new(*DEFLATE_ARGS)
  @body.each { |part| yield deflater.deflate(part, Zlib::SYNC_FLUSH) }
  yield deflater.finish
  nil
ensure
  @body.close if @body.respond_to?(:close)
  deflater.close
end