Class: Omnizip::ArchiveHandlers::ZipHandler::WriterProxy
- Inherits:
-
Object
- Object
- Omnizip::ArchiveHandlers::ZipHandler::WriterProxy
- Defined in:
- lib/omnizip/archive_handlers/zip_handler.rb
Overview
Translates the generic add(name, source_path) and
add_data(name, data) interface onto the native writer
Instance Method Summary collapse
- #add(name, source_path = nil, &block) ⇒ Object
- #add_data(name, data) ⇒ Object
-
#initialize(writer) ⇒ WriterProxy
constructor
A new instance of WriterProxy.
Constructor Details
#initialize(writer) ⇒ WriterProxy
Returns a new instance of WriterProxy.
82 83 84 |
# File 'lib/omnizip/archive_handlers/zip_handler.rb', line 82 def initialize(writer) @writer = writer end |
Instance Method Details
#add(name, source_path = nil, &block) ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/omnizip/archive_handlers/zip_handler.rb', line 86 def add(name, source_path = nil, &block) if source_path @writer.add_file(source_path, name) elsif block @writer.add_data(name, yield) else @writer.add_directory(name) end end |
#add_data(name, data) ⇒ Object
96 97 98 |
# File 'lib/omnizip/archive_handlers/zip_handler.rb', line 96 def add_data(name, data) @writer.add_data(name, data) end |