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.
46 47 48 49 |
# File 'lib/httpx/transcoder/gzip.rb', line 46 def initialize(bytesize) @inflater = Zlib::Inflate.new(Zlib::MAX_WBITS + 32) @bytesize = bytesize end |
Instance Method Details
#call(chunk) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/httpx/transcoder/gzip.rb', line 51 def call(chunk) buffer = @inflater.inflate(chunk) @bytesize -= chunk.bytesize if @bytesize <= 0 buffer << @inflater.finish @inflater.close end buffer end |