Class: Omnizip::ArchiveHandlers::SevenZipHandler::FileProxy
- Inherits:
-
Object
- Object
- Omnizip::ArchiveHandlers::SevenZipHandler::FileProxy
- Defined in:
- lib/omnizip/archive_handlers/seven_zip_handler.rb
Overview
Translates the generic add(name, source_path) interface to
the 7z writer's add_file(file_path, archive_path).
Instance Method Summary collapse
-
#add(name, source_path = nil) ⇒ Object
Directory entries are a no-op: 7z archives derive the directory tree from the files' archive paths ("sub/f.txt" implies "sub/"), and the writer/reader handle slashed paths (verified against 7zz).
-
#initialize(writer) ⇒ FileProxy
constructor
A new instance of FileProxy.
Constructor Details
#initialize(writer) ⇒ FileProxy
Returns a new instance of FileProxy.
39 40 41 |
# File 'lib/omnizip/archive_handlers/seven_zip_handler.rb', line 39 def initialize(writer) @writer = writer end |
Instance Method Details
#add(name, source_path = nil) ⇒ Object
Directory entries are a no-op: 7z archives derive the directory tree from the files' archive paths ("sub/f.txt" implies "sub/"), and the writer/reader handle slashed paths (verified against 7zz).
47 48 49 50 51 |
# File 'lib/omnizip/archive_handlers/seven_zip_handler.rb', line 47 def add(name, source_path = nil) return if source_path.nil? @writer.add_file(source_path, name) end |