Class: HTTPX::Transcoder::GZIP::Inflater
- Inherits:
-
Object
- Object
- HTTPX::Transcoder::GZIP::Inflater
- Defined in:
- lib/httpx/transcoder/gzip.rb
Instance Method Summary collapse
- #call(chunk) ⇒ Object
-
#initialize(bytesize) ⇒ Inflater
constructor
A new instance of Inflater.
Constructor Details
#initialize(bytesize) ⇒ Inflater
Returns a new instance of Inflater.
43 44 45 46 |
# File 'lib/httpx/transcoder/gzip.rb', line 43 def initialize(bytesize) @inflater = Zlib::Inflate.new(Zlib::MAX_WBITS + 32) @bytesize = bytesize end |
Instance Method Details
#call(chunk) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/httpx/transcoder/gzip.rb', line 48 def call(chunk) buffer = @inflater.inflate(chunk) @bytesize -= chunk.bytesize if @bytesize <= 0 buffer << @inflater.finish @inflater.close end buffer end |