Module: Omnizip::Entry
- Included in:
- Formats::Cpio::Entry, Formats::Iso::DirectoryRecord, Formats::Msi::Entry, Formats::Ole::Dirent, Formats::Rar3::Entry, Formats::Rar5::Entry, Formats::Rpm::Entry, Formats::SevenZip::Models::FileEntry, Formats::Tar::Entry, Formats::Xar::Entry, Metadata::EntryMetadata, Zip::Entry
- Defined in:
- lib/omnizip/entry.rb
Overview
Mix-in that establishes the common contract every archive entry satisfies, regardless of format.
Each format-specific entry class (Zip::Entry, Tar::Entry,
SevenZip::Models::FileEntry, Iso::DirectoryRecord, Ole::Dirent,
Xar::Entry, Rpm::Entry, Msi::Entry, Cpio::Entry, Rar3::Entry,
Rar5::Entry, Xz::Entry, Metadata::EntryMetadata) includes this
module so callers can rely on a single narrow interface instead
of duck-typing through respond_to?(:name) / :path / :filename
cascades.
Including classes MUST override the four methods below. The
defaults raise NotImplementedError to surface missing
implementations at call time rather than at include time.
Instance Method Summary collapse
-
#entry_directory? ⇒ Boolean
True if the entry is a directory.
-
#entry_mtime ⇒ Time?
Modification time.
-
#entry_name ⇒ String?
In-archive path, or nil if the entry has no name (e.g. empty anti-entry).
-
#entry_size ⇒ Integer?
Uncompressed size in bytes.
Instance Method Details
#entry_directory? ⇒ Boolean
Returns true if the entry is a directory.
27 28 29 30 |
# File 'lib/omnizip/entry.rb', line 27 def entry_directory? raise NotImplementedError, "#{self.class} must implement #entry_directory?" end |
#entry_mtime ⇒ Time?
Returns modification time.
39 40 41 42 |
# File 'lib/omnizip/entry.rb', line 39 def entry_mtime raise NotImplementedError, "#{self.class} must implement #entry_mtime" end |
#entry_name ⇒ String?
Returns in-archive path, or nil if the entry has no name (e.g. empty anti-entry).
21 22 23 24 |
# File 'lib/omnizip/entry.rb', line 21 def entry_name raise NotImplementedError, "#{self.class} must implement #entry_name" end |
#entry_size ⇒ Integer?
Returns uncompressed size in bytes.
33 34 35 36 |
# File 'lib/omnizip/entry.rb', line 33 def entry_size raise NotImplementedError, "#{self.class} must implement #entry_size" end |