Class: HTTP::Features::AutoDeflate::DeflatedBody

Inherits:
CompressedBody show all
Defined in:
lib/http/features/auto_deflate.rb

Instance Attribute Summary

Attributes inherited from Request::Body

#source

Instance Method Summary collapse

Methods inherited from CompressedBody

#each, #initialize, #size

Methods inherited from Request::Body

#==, #each, #initialize, #size

Constructor Details

This class inherits a constructor from HTTP::Features::AutoDeflate::CompressedBody

Instance Method Details

#compressObject


111
112
113
114
115
116
117
118
119
# File 'lib/http/features/auto_deflate.rb', line 111

def compress
  deflater = Zlib::Deflate.new

  @body.each { |chunk| yield deflater.deflate(chunk) }

  yield deflater.finish
ensure
  deflater.close
end