class Rack::Deflater::GzipStream
Public Class Methods
new(body, mtime)
click to toggle source
# File lib/rack/deflater.rb, line 68 def initialize(body, mtime) @body = body @mtime = mtime end
Public Instance Methods
each(&block)
click to toggle source
# File lib/rack/deflater.rb, line 73 def each(&block) @writer = block gzip =::Zlib::GzipWriter.new(self) gzip.mtime = @mtime @body.each { |part| gzip.write(part) gzip.flush } ensure @body.close if @body.respond_to?(:close) gzip.close @writer = nil end
write(data)
click to toggle source
# File lib/rack/deflater.rb, line 87 def write(data) @writer.call(data) end