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/crypto/decrypted_io.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, DecompressionError, Decompressor, DecryptedIo, Decrypter, Deflater, DestinationFileExistsError, Encrypter, Entry, EntryExistsError, EntryNameError, EntrySet, EntrySizeError, Error, ExtraField, File, GPFBit3Error, Inflater, InputStream, InternalError, NullCompressor, NullDecrypter, NullEncrypter, OutputStream, PassThruCompressor, PassThruDecompressor, StreamableDirectory, StreamableStream, TraditionalDecrypter, TraditionalEncrypter
Constant Summary collapse
- V3_API_WARNING_MSG =
<<~END_MSG You have called '%s' (from %s). This method is changing or deprecated in version 3.0.0. Please see https://github.com/rubyzip/rubyzip/wiki/Updating-to-version-3.x for more information. END_MSG
- ZipError =
Backwards compatibility with v1 (delete in v2)
Error
- ZipEntryExistsError =
EntryExistsError
- ZipDestinationFileExistsError =
DestinationFileExistsError
- ZipCompressionMethodError =
CompressionMethodError
- ZipEntryNameError =
EntryNameError
- ZipInternalError =
InternalError
- VERSION =
'2.4.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 =
0o10
- FILE_TYPE_DIR =
0o04
- FILE_TYPE_SYMLINK =
0o12
- 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
- COMPRESSION_METHOD_STORE =
0
- COMPRESSION_METHOD_SHRINK =
1
- COMPRESSION_METHOD_REDUCE_1 =
2
- COMPRESSION_METHOD_REDUCE_2 =
3
- COMPRESSION_METHOD_REDUCE_3 =
4
- COMPRESSION_METHOD_REDUCE_4 =
5
- COMPRESSION_METHOD_IMPLODE =
6
- COMPRESSION_METHOD_DEFLATE =
RESERVED = 7
8
- COMPRESSION_METHOD_DEFLATE_64 =
9
- COMPRESSION_METHOD_PKWARE_DCLI =
10
- COMPRESSION_METHOD_BZIP2 =
RESERVED = 11
12
- COMPRESSION_METHOD_LZMA =
RESERVED = 13
14
- COMPRESSION_METHOD_IBM_CMPSC =
RESERVED = 15
16
- COMPRESSION_METHOD_IBM_TERSE =
RESERVED = 17
18
- COMPRESSION_METHOD_IBM_LZ77 =
19
- COMPRESSION_METHOD_JPEG =
96
- COMPRESSION_METHOD_WAVPACK =
97
- COMPRESSION_METHOD_PPMD =
98
- COMPRESSION_METHOD_AES =
99
- COMPRESSION_METHODS =
{ COMPRESSION_METHOD_STORE => 'Store (no compression)', COMPRESSION_METHOD_SHRINK => 'Shrink', COMPRESSION_METHOD_REDUCE_1 => 'Reduce with compression factor 1', COMPRESSION_METHOD_REDUCE_2 => 'Reduce with compression factor 2', COMPRESSION_METHOD_REDUCE_3 => 'Reduce with compression factor 3', COMPRESSION_METHOD_REDUCE_4 => 'Reduce with compression factor 4', COMPRESSION_METHOD_IMPLODE => 'Implode', # RESERVED = 7 COMPRESSION_METHOD_DEFLATE => 'Deflate', COMPRESSION_METHOD_DEFLATE_64 => 'Deflate64(tm)', COMPRESSION_METHOD_PKWARE_DCLI => 'PKWARE Data Compression Library Imploding (old IBM TERSE)', # RESERVED = 11 COMPRESSION_METHOD_BZIP2 => 'BZIP2', # RESERVED = 13 COMPRESSION_METHOD_LZMA => 'LZMA', # RESERVED = 15 COMPRESSION_METHOD_IBM_CMPSC => 'IBM z/OS CMPSC Compression', # RESERVED = 17 COMPRESSION_METHOD_IBM_TERSE => 'IBM TERSE (new)', COMPRESSION_METHOD_IBM_LZ77 => 'IBM LZ77 z Architecture (PFS)', COMPRESSION_METHOD_JPEG => 'JPEG variant', COMPRESSION_METHOD_WAVPACK => 'WavPack compressed data', COMPRESSION_METHOD_PPMD => 'PPMd version I, Rev 1', COMPRESSION_METHOD_AES => 'AES encryption' }.freeze
Instance Attribute Summary collapse
-
#case_insensitive_match ⇒ Object
Returns the value of attribute case_insensitive_match.
-
#continue_on_exists_proc ⇒ Object
Returns the value of attribute continue_on_exists_proc.
-
#default_compression ⇒ Object
Returns the value of attribute default_compression.
-
#force_entry_names_encoding ⇒ Object
Returns the value of attribute force_entry_names_encoding.
-
#on_exists_proc ⇒ Object
Returns the value of attribute on_exists_proc.
-
#sort_entries ⇒ Object
Returns the value of attribute sort_entries.
-
#unicode_names ⇒ Object
Returns the value of attribute unicode_names.
-
#validate_entry_sizes ⇒ Object
Returns the value of attribute validate_entry_sizes.
-
#warn_invalid_date ⇒ Object
Returns the value of attribute warn_invalid_date.
-
#write_zip64_support ⇒ Object
Returns the value of attribute write_zip64_support.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#case_insensitive_match ⇒ Object
Returns the value of attribute case_insensitive_match.
57 58 59 |
# File 'lib/zip.rb', line 57 def case_insensitive_match @case_insensitive_match end |
#continue_on_exists_proc ⇒ Object
Returns the value of attribute continue_on_exists_proc.
57 58 59 |
# File 'lib/zip.rb', line 57 def continue_on_exists_proc @continue_on_exists_proc end |
#default_compression ⇒ Object
Returns the value of attribute default_compression.
57 58 59 |
# File 'lib/zip.rb', line 57 def default_compression @default_compression end |
#force_entry_names_encoding ⇒ Object
Returns the value of attribute force_entry_names_encoding.
57 58 59 |
# File 'lib/zip.rb', line 57 def force_entry_names_encoding @force_entry_names_encoding end |
#on_exists_proc ⇒ Object
Returns the value of attribute on_exists_proc.
57 58 59 |
# File 'lib/zip.rb', line 57 def on_exists_proc @on_exists_proc end |
#sort_entries ⇒ Object
Returns the value of attribute sort_entries.
57 58 59 |
# File 'lib/zip.rb', line 57 def sort_entries @sort_entries end |
#unicode_names ⇒ Object
Returns the value of attribute unicode_names.
57 58 59 |
# File 'lib/zip.rb', line 57 def unicode_names @unicode_names end |
#validate_entry_sizes ⇒ Object
Returns the value of attribute validate_entry_sizes.
57 58 59 |
# File 'lib/zip.rb', line 57 def validate_entry_sizes @validate_entry_sizes end |
#warn_invalid_date ⇒ Object
Returns the value of attribute warn_invalid_date.
57 58 59 |
# File 'lib/zip.rb', line 57 def warn_invalid_date @warn_invalid_date end |
#write_zip64_support ⇒ Object
Returns the value of attribute write_zip64_support.
57 58 59 |
# File 'lib/zip.rb', line 57 def write_zip64_support @write_zip64_support end |
Class Method Details
.warn_about_v3_api(method) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/zip.rb', line 44 def self.warn_about_v3_api(method) return unless ENV['RUBYZIP_V3_API_WARN'] loc = caller_locations(2, 1)[0] from = "#{loc.path.split('/').last}:#{loc.lineno}" warn format(V3_API_WARNING_MSG, method, from) end |
Instance Method Details
#reset! ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/zip.rb', line 68 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 @validate_entry_sizes = true end |
#setup {|_self| ... } ⇒ Object
81 82 83 84 |
# File 'lib/zip.rb', line 81 def setup yield self unless @_ran_once @_ran_once = true end |