Class: HTTPX::Plugins::Compression::GZIP::Inflater
- Inherits:
-
Object
- Object
- HTTPX::Plugins::Compression::GZIP::Inflater
- Defined in:
- lib/httpx/plugins/compression/gzip.rb
Instance Method Summary collapse
- #inflate(chunk) ⇒ Object
-
#initialize(bytesize) ⇒ Inflater
constructor
A new instance of Inflater.
Constructor Details
#initialize(bytesize) ⇒ Inflater
Returns a new instance of Inflater.
58 59 60 61 62 |
# File 'lib/httpx/plugins/compression/gzip.rb', line 58 def initialize(bytesize) @inflater = Zlib::Inflate.new(32 + Zlib::MAX_WBITS) @bytesize = bytesize @buffer = nil end |
Instance Method Details
#inflate(chunk) ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/httpx/plugins/compression/gzip.rb', line 64 def inflate(chunk) buffer = @inflater.inflate(chunk) @bytesize -= chunk.bytesize if @bytesize <= 0 buffer << @inflater.finish @inflater.close end buffer end |