A convenient wrapper for the zlib standard library that allows compression/decompression of strings with gzip.
Compresses a string using gzip.
# File lib/facets/standard/facets/zlib.rb, line 16 def self.compress(source) output = StringIO.new class << output def close; rewind; end end gz = GzipWriter.new(output) gz.write(source) gz.close output.string end
Decompresses a gzipped string.
# File lib/facets/standard/facets/zlib.rb, line 11 def self.decompress(source) GzipReader.new(StringIO.new(source)).read end
Generated with the Darkfish Rdoc Generator 2.