Document or hide classes from the docs.
This commit is contained in:
parent
0aa10bf7d5
commit
2ffbfebb88
|
@ -5,7 +5,7 @@ require 'forwardable'
|
|||
require_relative 'dirtyable'
|
||||
|
||||
module Zip
|
||||
class CentralDirectory
|
||||
class CentralDirectory # :nodoc:
|
||||
extend Forwardable
|
||||
include Dirtyable
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class Compressor #:nodoc:all
|
||||
class Compressor # :nodoc:all
|
||||
def finish; end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class DecryptedIo #:nodoc:all
|
||||
class DecryptedIo # :nodoc:all
|
||||
CHUNK_SIZE = 32_768
|
||||
|
||||
def initialize(io, decrypter)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class Encrypter #:nodoc:all
|
||||
class Encrypter # :nodoc:all
|
||||
end
|
||||
|
||||
class Decrypter
|
||||
class Decrypter # :nodoc:all
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
class NullEncrypter < Encrypter
|
||||
class NullEncrypter < Encrypter # :nodoc:
|
||||
include NullEncryption
|
||||
|
||||
def header(_mtime)
|
||||
|
@ -29,7 +29,7 @@ module Zip
|
|||
def reset!; end
|
||||
end
|
||||
|
||||
class NullDecrypter < Decrypter
|
||||
class NullDecrypter < Decrypter # :nodoc:
|
||||
include NullEncryption
|
||||
|
||||
def decrypt(data)
|
||||
|
|
|
@ -38,7 +38,7 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
class TraditionalEncrypter < Encrypter
|
||||
class TraditionalEncrypter < Encrypter # :nodoc:
|
||||
include TraditionalEncryption
|
||||
|
||||
def header(mtime)
|
||||
|
@ -72,7 +72,7 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
class TraditionalDecrypter < Decrypter
|
||||
class TraditionalDecrypter < Decrypter # :nodoc:
|
||||
include TraditionalEncryption
|
||||
|
||||
def decrypt(data)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class Decompressor #:nodoc:all
|
||||
class Decompressor # :nodoc:all
|
||||
CHUNK_SIZE = 32_768
|
||||
|
||||
def self.decompressor_classes
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class Deflater < Compressor #:nodoc:all
|
||||
class Deflater < Compressor # :nodoc:all
|
||||
def initialize(output_stream, level = Zip.default_compression, encrypter = NullEncrypter.new)
|
||||
super()
|
||||
@output_stream = output_stream
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require 'rubygems'
|
||||
|
||||
module Zip
|
||||
class DOSTime < Time #:nodoc:all
|
||||
class DOSTime < Time # :nodoc:all
|
||||
# MS-DOS File Date and Time format as used in Interrupt 21H Function 57H:
|
||||
|
||||
# Register CX, the Time:
|
||||
|
|
|
@ -5,6 +5,7 @@ require 'pathname'
|
|||
require_relative 'dirtyable'
|
||||
|
||||
module Zip
|
||||
# Zip::Entry represents an entry in a Zip archive.
|
||||
class Entry
|
||||
include Dirtyable
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class EntrySet #:nodoc:all
|
||||
class EntrySet # :nodoc:all
|
||||
include Enumerable
|
||||
|
||||
attr_reader :entry_set
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
# The superclass for all rubyzip error types. Simply rescue this one if
|
||||
# you don't need to know what sort of error has been raised.
|
||||
class Error < StandardError; end
|
||||
|
||||
# Error raised if an unsupported compression method is used.
|
||||
class CompressionMethodError < Error
|
||||
attr_reader :compression_method
|
||||
|
||||
|
@ -16,6 +19,7 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Error raised if there is a problem while decompressing an archive entry.
|
||||
class DecompressionError < Error
|
||||
attr_reader :zlib_error
|
||||
|
||||
|
@ -29,6 +33,8 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Error raised when trying to extract an archive entry over an
|
||||
# existing file.
|
||||
class DestinationExistsError < Error
|
||||
def initialize(destination)
|
||||
super()
|
||||
|
@ -41,6 +47,8 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Error raised when trying to add an entry to an archive where the
|
||||
# entry name already exists.
|
||||
class EntryExistsError < Error
|
||||
def initialize(source, name)
|
||||
super()
|
||||
|
@ -53,6 +61,7 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Error raised when an entry name is invalid.
|
||||
class EntryNameError < Error
|
||||
def initialize(name = nil)
|
||||
super()
|
||||
|
@ -68,6 +77,8 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Error raised if an entry is larger on extraction than it is advertised
|
||||
# to be.
|
||||
class EntrySizeError < Error
|
||||
attr_reader :entry
|
||||
|
||||
|
@ -81,12 +92,15 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Error raised if a split archive is read. Rubyzip does not support reading
|
||||
# split archives.
|
||||
class SplitArchiveError < Error
|
||||
def message
|
||||
'Rubyzip cannot extract from split archives at this time.'
|
||||
end
|
||||
end
|
||||
|
||||
# Error raised if there is not enough metadata for the entry to be streamed.
|
||||
class StreamingError < Error
|
||||
attr_reader :entry
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class ExtraField < Hash
|
||||
class ExtraField < Hash # :nodoc:all
|
||||
ID_MAP = {}
|
||||
|
||||
def initialize(binstr = nil, local: false)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class ExtraField::Generic
|
||||
class ExtraField::Generic # :nodoc:
|
||||
def self.register_map
|
||||
return unless const_defined?(:HEADER_ID)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
module Zip
|
||||
# PKWARE NTFS Extra Field (0x000a)
|
||||
# Only Tag 0x0001 is supported
|
||||
class ExtraField::NTFS < ExtraField::Generic
|
||||
class ExtraField::NTFS < ExtraField::Generic # :nodoc:
|
||||
HEADER_ID = [0x000A].pack('v')
|
||||
register_map
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module Zip
|
||||
# Olf Info-ZIP Extra for UNIX uid/gid and file timestampes
|
||||
class ExtraField::OldUnix < ExtraField::Generic
|
||||
class ExtraField::OldUnix < ExtraField::Generic # :nodoc:
|
||||
HEADER_ID = 'UX'
|
||||
register_map
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module Zip
|
||||
# Info-ZIP Additional timestamp field
|
||||
class ExtraField::UniversalTime < ExtraField::Generic
|
||||
class ExtraField::UniversalTime < ExtraField::Generic # :nodoc:
|
||||
HEADER_ID = 'UT'
|
||||
register_map
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module Zip
|
||||
# Info-ZIP Extra for UNIX uid/gid
|
||||
class ExtraField::IUnix < ExtraField::Generic
|
||||
class ExtraField::IUnix < ExtraField::Generic # :nodoc:
|
||||
HEADER_ID = 'Ux'
|
||||
register_map
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module Zip
|
||||
# A class to hold unknown extra fields so that they are preserved.
|
||||
class ExtraField::Unknown
|
||||
class ExtraField::Unknown # :nodoc:
|
||||
def initialize
|
||||
@local_bin = +''
|
||||
@cdir_bin = +''
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module Zip
|
||||
# Info-ZIP Extra for Zip64 size
|
||||
class ExtraField::Zip64 < ExtraField::Generic
|
||||
class ExtraField::Zip64 < ExtraField::Generic # :nodoc:
|
||||
attr_accessor :compressed_size, :disk_start_number,
|
||||
:original_size, :relative_header_offset
|
||||
|
||||
|
|
|
@ -5,48 +5,49 @@ require 'forwardable'
|
|||
require_relative 'file_split'
|
||||
|
||||
module Zip
|
||||
# ZipFile is modeled after java.util.zip.ZipFile from the Java SDK.
|
||||
# The most important methods are those inherited from
|
||||
# ZipCentralDirectory for accessing information about the entries in
|
||||
# the archive and methods such as get_input_stream and
|
||||
# get_output_stream for reading from and writing entries to the
|
||||
# Zip::File is modeled after java.util.zip.ZipFile from the Java SDK.
|
||||
# The most important methods are those for accessing information about
|
||||
# the entries in
|
||||
# the archive and methods such as `get_input_stream` and
|
||||
# `get_output_stream` for reading from and writing entries to the
|
||||
# archive. The class includes a few convenience methods such as
|
||||
# #extract for extracting entries to the filesystem, and #remove,
|
||||
# #replace, #rename and #mkdir for making simple modifications to
|
||||
# `extract` for extracting entries to the filesystem, and `remove`,
|
||||
# `replace`, `rename` and `mkdir` for making simple modifications to
|
||||
# the archive.
|
||||
#
|
||||
# Modifications to a zip archive are not committed until #commit or
|
||||
# #close is called. The method #open accepts a block following
|
||||
# the pattern from File.open offering a simple way to
|
||||
# Modifications to a zip archive are not committed until `commit` or
|
||||
# `close` is called. The method `open` accepts a block following
|
||||
# the pattern from ::File.open offering a simple way to
|
||||
# automatically close the archive when the block returns.
|
||||
#
|
||||
# The following example opens zip archive <code>my.zip</code>
|
||||
# The following example opens zip archive `my.zip`
|
||||
# (creating it if it doesn't exist) and adds an entry
|
||||
# <code>first.txt</code> and a directory entry <code>a_dir</code>
|
||||
# `first.txt` and a directory entry `a_dir`
|
||||
# to it.
|
||||
#
|
||||
# require 'zip'
|
||||
# ```
|
||||
# require 'zip'
|
||||
#
|
||||
# Zip::File.open("my.zip", create: true) {
|
||||
# |zipfile|
|
||||
# zipfile.get_output_stream("first.txt") { |f| f.puts "Hello from ZipFile" }
|
||||
# zipfile.mkdir("a_dir")
|
||||
# }
|
||||
# Zip::File.open('my.zip', create: true) do |zipfile|
|
||||
# zipfile.get_output_stream('first.txt') { |f| f.puts 'Hello from Zip::File' }
|
||||
# zipfile.mkdir('a_dir')
|
||||
# end
|
||||
# ```
|
||||
#
|
||||
# The next example reopens <code>my.zip</code> writes the contents of
|
||||
# <code>first.txt</code> to standard out and deletes the entry from
|
||||
# The next example reopens `my.zip`, writes the contents of
|
||||
# `first.txt` to standard out and deletes the entry from
|
||||
# the archive.
|
||||
#
|
||||
# require 'zip'
|
||||
# ```
|
||||
# require 'zip'
|
||||
#
|
||||
# Zip::File.open("my.zip", create: true) {
|
||||
# |zipfile|
|
||||
# puts zipfile.read("first.txt")
|
||||
# zipfile.remove("first.txt")
|
||||
# }
|
||||
# Zip::File.open('my.zip', create: true) do |zipfile|
|
||||
# puts zipfile.read('first.txt')
|
||||
# zipfile.remove('first.txt')
|
||||
# end
|
||||
#
|
||||
# ZipFileSystem offers an alternative API that emulates ruby's
|
||||
# interface for accessing the filesystem, ie. the File and Dir classes.
|
||||
# Zip::FileSystem offers an alternative API that emulates ruby's
|
||||
# interface for accessing the filesystem, ie. the ::File and ::Dir classes.
|
||||
class File
|
||||
extend Forwardable
|
||||
extend FileSplit
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class Inflater < Decompressor #:nodoc:all
|
||||
class Inflater < Decompressor # :nodoc:all
|
||||
def initialize(*args)
|
||||
super
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class NullCompressor < Compressor #:nodoc:all
|
||||
class NullCompressor < Compressor # :nodoc:all
|
||||
include Singleton
|
||||
|
||||
def <<(_data)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class PassThruCompressor < Compressor #:nodoc:all
|
||||
class PassThruCompressor < Compressor # :nodoc:all
|
||||
def initialize(output_stream)
|
||||
super()
|
||||
@output_stream = output_stream
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class PassThruDecompressor < Decompressor #:nodoc:all
|
||||
class PassThruDecompressor < Decompressor # :nodoc:all
|
||||
def initialize(*args)
|
||||
super
|
||||
@read_so_far = 0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Zip
|
||||
class StreamableDirectory < Entry
|
||||
class StreamableDirectory < Entry # :nodoc:
|
||||
def initialize(zipfile, entry, src_path = nil, permission = nil)
|
||||
super(zipfile, entry)
|
||||
|
||||
|
|
Loading…
Reference in New Issue