A convenient wrapper for the zlib standard library that allows compression/decompression of strings with gzip.
Methods
Classes and Modules
Class ActiveSupport::Gzip::StreamPublic Class methods
Compresses a string using gzip.
[ show source ]
# File activesupport/lib/active_support/gzip.rb, line 17
17: def self.compress(source)
18: output = Stream.new
19: gz = Zlib::GzipWriter.new(output)
20: gz.write(source)
21: gz.close
22: output.string
23: end
Decompresses a gzipped string.
[ show source ]
# File activesupport/lib/active_support/gzip.rb, line 12
12: def self.decompress(source)
13: Zlib::GzipReader.new(StringIO.new(source)).read
14: end