# File lib/rack/deflater.rb, line 74 def initialize(body, mtime) @body = body @mtime = mtime @closed = false end
# File lib/rack/deflater.rb, line 97 def close return if @closed @closed = true @body.close if @body.respond_to?(:close) end
# File lib/rack/deflater.rb, line 80 def each(&block) @writer = block gzip =::Zlib::GzipWriter.new(self) gzip.mtime = @mtime @body.each { |part| gzip.write(part) gzip.flush } ensure gzip.close @writer = nil end
# File lib/rack/deflater.rb, line 93 def write(data) @writer.call(data) end