Class: Rack::Deflater::GzipStream
- Inherits:
-
Object
- Object
- Rack::Deflater::GzipStream
- Defined in:
- lib/rack/deflater.rb
Instance Method Summary (collapse)
- - (Object) each(&block)
-
- (GzipStream) initialize(body, mtime)
constructor
A new instance of GzipStream.
- - (Object) write(data)
Constructor Details
- (GzipStream) initialize(body, mtime)
A new instance of GzipStream
55 56 57 58 |
# File 'lib/rack/deflater.rb', line 55 def initialize(body, mtime) @body = body @mtime = mtime end |
Instance Method Details
- (Object) each(&block)
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rack/deflater.rb', line 60 def each(&block) @writer = block gzip =::Zlib::GzipWriter.new(self) gzip.mtime = @mtime @body.each { |part| gzip.write(part) gzip.flush } @body.close if @body.respond_to?(:close) gzip.close @writer = nil end |
- (Object) write(data)
73 74 75 |
# File 'lib/rack/deflater.rb', line 73 def write(data) @writer.call(data) end |