Namespace

Zlib

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/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
decompress(source) click to toggle source

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
deflate(string, level=DEFAULT_COMPRESSION) click to toggle source

Deflate a string.

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

Inflate a deflated sting.

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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.