Class: Dalli::GzipCompressor
- Inherits:
-
Object
- Object
- Dalli::GzipCompressor
- Defined in:
- lib/dalli/compressor.rb
Class Method Summary collapse
Class Method Details
.compress(data) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/dalli/compressor.rb', line 16 def self.compress(data) io = StringIO.new("w") gz = Zlib::GzipWriter.new(io) gz.write(data) gz.close io.string end |
.decompress(data) ⇒ Object
24 25 26 27 |
# File 'lib/dalli/compressor.rb', line 24 def self.decompress(data) io = StringIO.new(data, "rb") Zlib::GzipReader.new(io).read end |