Class: Zipper::ZipFileGenerator

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

Instance Method Summary collapse

Constructor Details

#initialize(json_config) ⇒ ZipFileGenerator

Initialize with the json config.



12
13
14
15
16
# File 'lib/zipper.rb', line 12

def initialize(json_config)
    @entries = json_config[JsonConfigKey::Entries]
    @ignore_entries = json_config[JsonConfigKey::IgnoreEntries]
    @output_file = json_config[JsonConfigKey::Name]
end

Instance Method Details

#writeObject

Zip the input entries.



19
20
21
22
23
24
# File 'lib/zipper.rb', line 19

def write
    buffer = create_zip(@entries, @ignore_entries)

    puts "\nwrite file #{@output_file}"
    File.open(@output_file, "wb") {|f| f.write buffer.string }
end