A convenient wrapper for the zlib standard library that allows compression/decompression of strings with gzip.
Namespace
Methods
- C
- D
Class Public methods
Compresses a string using gzip.
Source: show
# File activesupport/lib/active_support/gzip.rb, line 22 def self.compress(source) output = Stream.new gz = Zlib::GzipWriter.new(output) gz.write(source) gz.close output.string end
Decompresses a gzipped string.
Source: show
# File activesupport/lib/active_support/gzip.rb, line 17 def self.decompress(source) Zlib::GzipReader.new(StringIO.new(source)).read end