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.
60 61 62 63 64 |
# File 'lib/httpx/plugins/compression/gzip.rb', line 60 def initialize(bytesize) @inflater = Zlib::Inflate.new(Zlib::MAX_WBITS + 32) @bytesize = bytesize @buffer = nil end |
Instance Method Details
#inflate(chunk) ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/httpx/plugins/compression/gzip.rb', line 66 def inflate(chunk) buffer = @inflater.inflate(chunk) @bytesize -= chunk.bytesize if @bytesize <= 0 buffer << @inflater.finish @inflater.close end buffer end |