A convenient wrapper for the zlib standard library that allows compression/decompression of strings with gzip.
Compresses a string using gzip.
# File lib/more/facets/zlib.rb, line 16
16: def self.compress(source)
17: output = StringIO.new
18: class << output
19: def close; rewind; end
20: end
21: gz = GzipWriter.new(output)
22: gz.write(source)
23: gz.close
24: output.string
25: end
Decompresses a gzipped string.
# File lib/more/facets/zlib.rb, line 11
11: def self.decompress(source)
12: GzipReader.new(StringIO.new(source)).read
13: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.