Class: Plum::Decoders::GZip
Instance Method Summary collapse
- #decode(chunk) ⇒ Object
- #finish ⇒ Object
-
#initialize ⇒ GZip
constructor
A new instance of GZip.
Constructor Details
#initialize ⇒ GZip
Returns a new instance of GZip.
32 33 34 |
# File 'lib/plum/client/decoders.rb', line 32 def initialize @stream = Zlib::Inflate.new(Zlib::MAX_WBITS + 16) end |
Instance Method Details
#decode(chunk) ⇒ Object
36 37 38 39 40 |
# File 'lib/plum/client/decoders.rb', line 36 def decode(chunk) @stream.inflate(chunk) rescue Zlib::Error => e raise DecoderError.new("failed to decode chunk", e) end |
#finish ⇒ Object
42 43 44 45 46 |
# File 'lib/plum/client/decoders.rb', line 42 def finish @stream.finish rescue Zlib::Error => e raise DecoderError.new("failed to finalize", e) end |