Class: Fdfinder::ZipFileGenerator
- Inherits:
-
Object
- Object
- Fdfinder::ZipFileGenerator
- Defined in:
- lib/fdfinder/zip_file_generator.rb
Instance Method Summary collapse
-
#initialize(inputDir, outputFile) ⇒ ZipFileGenerator
constructor
Initialize with the directory to zip and the location of the output archive.
-
#write ⇒ Object
Zip the input directory.
Constructor Details
#initialize(inputDir, outputFile) ⇒ ZipFileGenerator
Initialize with the directory to zip and the location of the output archive.
14 15 16 17 |
# File 'lib/fdfinder/zip_file_generator.rb', line 14 def initialize(inputDir, outputFile) @inputDir = inputDir @outputFile = outputFile end |
Instance Method Details
#write ⇒ Object
Zip the input directory.
20 21 22 23 24 25 26 |
# File 'lib/fdfinder/zip_file_generator.rb', line 20 def write() entries = Dir.entries(@inputDir); entries.delete("."); entries.delete("..") io = Zip::File.open(@outputFile, Zip::File::CREATE); writeEntries(entries, "", io) io.close(); end |