Module: Zip

Extended by:
Zip
Included in:
Zip
Defined in:
lib/zip.rb,
lib/zip/file.rb,
lib/zip/entry.rb,
lib/zip/errors.rb,
lib/zip/version.rb,
lib/zip/deflater.rb,
lib/zip/dos_time.rb,
lib/zip/inflater.rb,
lib/zip/ioextras.rb,
lib/zip/constants.rb,
lib/zip/entry_set.rb,
lib/zip/compressor.rb,
lib/zip/filesystem.rb,
lib/zip/extra_field.rb,
lib/zip/decompressor.rb,
lib/zip/input_stream.rb,
lib/zip/output_stream.rb,
lib/zip/null_compressor.rb,
lib/zip/extra_field/ntfs.rb,
lib/zip/extra_field/unix.rb,
lib/zip/central_directory.rb,
lib/zip/crypto/encryption.rb,
lib/zip/extra_field/zip64.rb,
lib/zip/null_decompressor.rb,
lib/zip/null_input_stream.rb,
lib/zip/streamable_stream.rb,
lib/zip/extra_field/generic.rb,
lib/zip/extra_field/old_unix.rb,
lib/zip/pass_thru_compressor.rb,
lib/zip/streamable_directory.rb,
lib/zip/crypto/null_encryption.rb,
lib/zip/pass_thru_decompressor.rb,
lib/zip/extra_field/universal_time.rb,
lib/zip/crypto/traditional_encryption.rb,
lib/zip/extra_field/zip64_placeholder.rb,
lib/zip/ioextras/abstract_input_stream.rb,
lib/zip/ioextras/abstract_output_stream.rb

Defined Under Namespace

Modules: FileSystem, IOExtras, NullDecompressor, NullEncryption, NullInputStream, TraditionalEncryption Classes: CentralDirectory, CompressionMethodError, Compressor, DOSTime, Decompressor, Decrypter, Deflater, DestinationFileExistsError, Encrypter, Entry, EntryExistsError, EntryNameError, EntrySet, Error, ExtraField, File, GPFBit3Error, Inflater, InputStream, InternalError, NullCompressor, NullDecrypter, NullEncrypter, OutputStream, PassThruCompressor, PassThruDecompressor, StreamableDirectory, StreamableStream, TraditionalDecrypter, TraditionalEncrypter

Constant Summary collapse

ZipError =

Backwards compatibility with v1 (delete in v2)

Error
ZipEntryExistsError =
EntryExistsError
ZipDestinationFileExistsError =
DestinationFileExistsError
ZipCompressionMethodError =
CompressionMethodError
ZipEntryNameError =
EntryNameError
ZipInternalError =
InternalError
VERSION =
'1.2.1'
RUNNING_ON_WINDOWS =
RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/i
CENTRAL_DIRECTORY_ENTRY_SIGNATURE =
0x02014b50
CDIR_ENTRY_STATIC_HEADER_LENGTH =
46
LOCAL_ENTRY_SIGNATURE =
0x04034b50
LOCAL_ENTRY_STATIC_HEADER_LENGTH =
30
LOCAL_ENTRY_TRAILING_DESCRIPTOR_LENGTH =
4 + 4 + 4
VERSION_MADE_BY =

this library’s version

52
VERSION_NEEDED_TO_EXTRACT =
20
VERSION_NEEDED_TO_EXTRACT_ZIP64 =
45
FILE_TYPE_FILE =
010
FILE_TYPE_DIR =
004
012
FSTYPE_FAT =
0
FSTYPE_AMIGA =
1
FSTYPE_VMS =
2
FSTYPE_UNIX =
3
FSTYPE_VM_CMS =
4
FSTYPE_ATARI =
5
FSTYPE_HPFS =
6
FSTYPE_MAC =
7
FSTYPE_Z_SYSTEM =
8
FSTYPE_CPM =
9
FSTYPE_TOPS20 =
10
FSTYPE_NTFS =
11
FSTYPE_QDOS =
12
FSTYPE_ACORN =
13
FSTYPE_VFAT =
14
FSTYPE_MVS =
15
FSTYPE_BEOS =
16
FSTYPE_TANDEM =
17
FSTYPE_THEOS =
18
FSTYPE_MAC_OSX =
19
FSTYPE_ATHEOS =
30
FSTYPES =
{
  FSTYPE_FAT      => 'FAT'.freeze,
  FSTYPE_AMIGA    => 'Amiga'.freeze,
  FSTYPE_VMS      => 'VMS (Vax or Alpha AXP)'.freeze,
  FSTYPE_UNIX     => 'Unix'.freeze,
  FSTYPE_VM_CMS   => 'VM/CMS'.freeze,
  FSTYPE_ATARI    => 'Atari ST'.freeze,
  FSTYPE_HPFS     => 'OS/2 or NT HPFS'.freeze,
  FSTYPE_MAC      => 'Macintosh'.freeze,
  FSTYPE_Z_SYSTEM => 'Z-System'.freeze,
  FSTYPE_CPM      => 'CP/M'.freeze,
  FSTYPE_TOPS20   => 'TOPS-20'.freeze,
  FSTYPE_NTFS     => 'NTFS'.freeze,
  FSTYPE_QDOS     => 'SMS/QDOS'.freeze,
  FSTYPE_ACORN    => 'Acorn RISC OS'.freeze,
  FSTYPE_VFAT     => 'Win32 VFAT'.freeze,
  FSTYPE_MVS      => 'MVS'.freeze,
  FSTYPE_BEOS     => 'BeOS'.freeze,
  FSTYPE_TANDEM   => 'Tandem NSK'.freeze,
  FSTYPE_THEOS    => 'Theos'.freeze,
  FSTYPE_MAC_OSX  => 'Mac OS/X (Darwin)'.freeze,
  FSTYPE_ATHEOS   => 'AtheOS'.freeze
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#case_insensitive_matchObject

Returns the value of attribute case_insensitive_match.



37
38
39
# File 'lib/zip.rb', line 37

def case_insensitive_match
  @case_insensitive_match
end

#continue_on_exists_procObject

Returns the value of attribute continue_on_exists_proc.



37
38
39
# File 'lib/zip.rb', line 37

def continue_on_exists_proc
  @continue_on_exists_proc
end

#default_compressionObject

Returns the value of attribute default_compression.



37
38
39
# File 'lib/zip.rb', line 37

def default_compression
  @default_compression
end

#on_exists_procObject

Returns the value of attribute on_exists_proc.



37
38
39
# File 'lib/zip.rb', line 37

def on_exists_proc
  @on_exists_proc
end

#sort_entriesObject

Returns the value of attribute sort_entries.



37
38
39
# File 'lib/zip.rb', line 37

def sort_entries
  @sort_entries
end

#unicode_namesObject

Returns the value of attribute unicode_names.



37
38
39
# File 'lib/zip.rb', line 37

def unicode_names
  @unicode_names
end

#warn_invalid_dateObject

Returns the value of attribute warn_invalid_date.



37
38
39
# File 'lib/zip.rb', line 37

def warn_invalid_date
  @warn_invalid_date
end

#write_zip64_supportObject

Returns the value of attribute write_zip64_support.



37
38
39
# File 'lib/zip.rb', line 37

def write_zip64_support
  @write_zip64_support
end

Instance Method Details

#reset!Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/zip.rb', line 39

def reset!
  @_ran_once = false
  @unicode_names = false
  @on_exists_proc = false
  @continue_on_exists_proc = false
  @sort_entries = false
  @default_compression = ::Zlib::DEFAULT_COMPRESSION
  @write_zip64_support = false
  @warn_invalid_date = true
  @case_insensitive_match = false
end

#setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Zip)

    the object that the method was called on



51
52
53
54
# File 'lib/zip.rb', line 51

def setup
  yield self unless @_ran_once
  @_ran_once = true
end