A convenient wrapper for the zlib standard library that allows compression/decompression of strings with gzip.

Namespace
Methods
C
D
Class Public methods
compress(source)

Compresses a string using gzip.

# File activesupport/lib/active_support/gzip.rb, line 17
def self.compress(source)
  output = Stream.new
  gz = Zlib::GzipWriter.new(output)
  gz.write(source)
  gz.close
  output.string
end
decompress(source)

Decompresses a gzipped string.

# File activesupport/lib/active_support/gzip.rb, line 12
def self.decompress(source)
  Zlib::GzipReader.new(StringIO.new(source)).read
end