Class Archive::Compress
In: lib/archive/compress.rb
Parent: Object

Compression OOP interface for Archive. See ::new and compress for more information.

Methods

compress   new  

Constants

BUFSIZE = 32767   The buffer size for reading content.

Attributes

compression  [R]  the compression type of the archive. See ::new.
filename  [R]  the filename of the compressed archive
type  [R]  the type of the archive. See ::new.

Public Class methods

Create a new Compress object. Takes a filename as string, and args as hash.

args is a hash that contains two values, :type and :compression.

  • :type may be :tar or :zip
  • :compression may be :gzip, :bzip2, or nil (no compression)

If the type :zip is selected, no compression will be used. Additionally, files in the .zip will all be stored as binary files.

The default set of arguments is

    { :type => :tar, :compression => :gzip }

Public Instance methods

Run the compression. Files are an array of filenames. Optional flag for verbosity; if true, will print each file it adds to the archive to stdout.

Files must be real files. No symlinks, directories, unix sockets, character devices, etc. This method will raise ArgumentError if you provide any.

[Validate]