Class: Plum::Decoders::Deflate
Overview
‘deflate` is not just deflate, wrapped by zlib format (RFC 1950)
Instance Method Summary collapse
- #decode(chunk) ⇒ Object
- #finish ⇒ Object
-
#initialize ⇒ Deflate
constructor
A new instance of Deflate.
Constructor Details
#initialize ⇒ Deflate
Returns a new instance of Deflate.
14 15 16 |
# File 'lib/plum/client/decoders.rb', line 14 def initialize @inflate = Zlib::Inflate.new(Zlib::MAX_WBITS) end |
Instance Method Details
#decode(chunk) ⇒ Object
18 19 20 21 22 |
# File 'lib/plum/client/decoders.rb', line 18 def decode(chunk) @inflate.inflate(chunk) rescue Zlib::Error => e raise DecoderError.new("failed to decode chunk", e) end |
#finish ⇒ Object
24 25 26 27 28 |
# File 'lib/plum/client/decoders.rb', line 24 def finish @inflate.finish rescue Zlib::Error => e raise DecoderError.new("failed to finalize", e) end |