Class: Fdfinder::ZipFileGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/fdfinder/zip_file_generator.rb

Instance Method Summary collapse

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

#writeObject

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