Class: Omnizip::ArchiveHandlers::TarHandler::EntryProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/omnizip/archive_handlers/tar_handler.rb

Overview

Translates the generic add(name, source_path) interface: a bare add(name) is a directory ENTRY (no source on disk relative to the caller), which the Tar writer's own add would misread as a CWD-relative path.

Instance Method Summary collapse

Constructor Details

#initialize(writer) ⇒ EntryProxy

Returns a new instance of EntryProxy.



44
45
46
# File 'lib/omnizip/archive_handlers/tar_handler.rb', line 44

def initialize(writer)
  @writer = writer
end

Instance Method Details

#add(name, source_path = nil) ⇒ Object



48
49
50
51
52
# File 'lib/omnizip/archive_handlers/tar_handler.rb', line 48

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

  @writer.add(name, source_path)
end