Module Zlib
In: lib/more/facets/zlib.rb

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

Methods

Public Class methods

Compresses a string using gzip.

[Source]

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

[Source]

    # File lib/more/facets/zlib.rb, line 11
11:   def self.decompress(source)
12:     GzipReader.new(StringIO.new(source)).read
13:   end

Deflate a string.

[Source]

    # File lib/more/facets/zlib.rb, line 33
33:   def self.deflate(string, level=DEFAULT_COMPRESSION)
34:     Deflate.deflate(string, level)
35:   end

Inflate a deflated sting.

[Source]

    # File lib/more/facets/zlib.rb, line 28
28:   def self.inflate(string)
29:     Inflate.inflate(string)
30:   end

[Validate]