Class: JWE::Zip::Def
- Inherits:
-
Object
- Object
- JWE::Zip::Def
- Defined in:
- lib/jwe/zip/def.rb
Overview
Deflate algorithm.
Instance Method Summary collapse
- #compress(payload) ⇒ Object
-
#decompress(payload) ⇒ Object
Was using RFC 1950 instead of 1951.
Instance Method Details
#compress(payload) ⇒ Object
7 8 9 10 |
# File 'lib/jwe/zip/def.rb', line 7 def compress(payload) zlib = Zlib::Deflate.new(Zlib::DEFAULT_COMPRESSION, -Zlib::MAX_WBITS) zlib.deflate(payload, Zlib::FINISH) end |
#decompress(payload) ⇒ Object
Was using RFC 1950 instead of 1951.
13 14 15 16 17 18 19 20 |
# File 'lib/jwe/zip/def.rb', line 13 def decompress(payload) Zlib::Inflate.inflate(payload) # Keeping compatibility for old encoded tokens rescue Zlib::DataError inflate = Zlib::Inflate.new(-Zlib::MAX_WBITS) inflate.inflate(payload) end |