Class: Zipper::ZipFileGenerator
- Inherits:
-
Object
- Object
- Zipper::ZipFileGenerator
- Defined in:
- lib/zipper.rb
Instance Method Summary collapse
-
#initialize(json_config) ⇒ ZipFileGenerator
constructor
Initialize with the json config.
-
#write ⇒ Object
Zip the input entries.
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
#write ⇒ Object
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 |