# module ActiveSupport::Gzip

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

### Public Class Methods

compress(source) click to toggle source

Compresses a string using gzip.

    # File 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

decompress(source) click to toggle source

Decompresses a gzipped string.

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