Class: Omnizip::ArchiveHandlers::SevenZipHandler::FileProxy

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(writer) ⇒ FileProxy

Returns a new instance of FileProxy.



63
64
65
# File 'lib/omnizip/archive_handlers/seven_zip_handler.rb', line 63

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).



71
72
73
74
75
# File 'lib/omnizip/archive_handlers/seven_zip_handler.rb', line 71

def add(name, source_path = nil)
  return if source_path.nil?

  @writer.add_file(source_path, name)
end

#add_data(name, data) ⇒ Object



77
78
79
# File 'lib/omnizip/archive_handlers/seven_zip_handler.rb', line 77

def add_data(name, data)
  @writer.add_data(name, data)
end