Module Zlib
In: lib/lore/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/lore/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.

[Source]

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

Deflate a string.

[Source]

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

Inflate a deflated sting.

[Source]

# File lib/lore/facets/zlib.rb, line 28
  def self.inflate(string)
    Inflate.inflate(string)
  end

[Validate]