Methods

Files

Class Index [+]

Quicksearch

GZip

GZip Simple

A simplified interface to the gzip library zlib (from the Ruby Standard Library.)

Author: murphy (mail to murphy rubychan de)

Version: 0.2 (2005.may.28)

Documentation

See GZip module and the String extensions.

Constants

DEFAULT_GZIP_LEVEL

The default zipping level. 7 zips good and fast.

Public Class Methods

gunzip(s) click to toggle source

Unzips the given string s.

Example:

  require 'gzip_simple'
  print GZip.gunzip(File.read('adresses.gz'))
    # File lib/coderay/helpers/gzip_simple.rb, line 25
25:   def GZip.gunzip s
26:     Zlib::Inflate.inflate s
27:   end
gzip(s, level = DEFAULT_GZIP_LEVEL) click to toggle source

Zips the given string s.

Example:

  require 'gzip_simple'
  File.open('adresses.gz', 'w') do |file
    file.write GZip.gzip('Mum: 0123 456 789', 9)
  end

If you provide a level, you can control how strong the string is compressed:

  • 0: no compression, only convert to gzip format

  • 1: compress fast

  • 7: compress more, but still fast (default)

  • 8: compress more, slower

  • 9: compress best, very slow

    # File lib/coderay/helpers/gzip_simple.rb, line 44
44:   def GZip.gzip s, level = DEFAULT_GZIP_LEVEL
45:     Zlib::Deflate.new(level).deflate s, Zlib::FINISH
46:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.