Class: Archive
- Inherits:
-
Struct
- Object
- Struct
- Archive
- Defined in:
- lib/archivegem.rb
Instance Attribute Summary collapse
-
#input_directory ⇒ Object
Returns the value of attribute input_directory.
-
#output_file ⇒ Object
Returns the value of attribute output_file.
-
#skip ⇒ Object
Returns the value of attribute skip.
Instance Method Summary collapse
Instance Attribute Details
#input_directory ⇒ Object
Returns the value of attribute input_directory
3 4 5 |
# File 'lib/archivegem.rb', line 3 def input_directory @input_directory end |
#output_file ⇒ Object
Returns the value of attribute output_file
3 4 5 |
# File 'lib/archivegem.rb', line 3 def output_file @output_file end |
#skip ⇒ Object
Returns the value of attribute skip
3 4 5 |
# File 'lib/archivegem.rb', line 3 def skip @skip end |
Instance Method Details
#zip ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/archivegem.rb', line 4 def zip entries = Dir.entries(input_directory) entries.delete('.') entries.delete('..') File.delete(output_file) if File.exist?(output_file) io = Zip::File.open(output_file, Zip::File::CREATE) write_zip_entries(entries, '', io) io.close() end |