Class: Nucleus::Archiver
- Inherits:
-
Object
- Object
- Nucleus::Archiver
- Defined in:
- lib/nucleus/core/common/files/archiver.rb
Instance Method Summary collapse
-
#compress(path, compression_format) ⇒ StringIO
Compress the files of the path into an archive, using the compression format, which indicates which method must be used to compress the archive.
-
#initialize(exclude_git = true) ⇒ Archiver
constructor
A new instance of Archiver.
Constructor Details
#initialize(exclude_git = true) ⇒ Archiver
Returns a new instance of Archiver.
3 4 5 |
# File 'lib/nucleus/core/common/files/archiver.rb', line 3 def initialize(exclude_git = true) @exclude_git = exclude_git end |
Instance Method Details
#compress(path, compression_format) ⇒ StringIO
Compress the files of the path into an archive, using the compression format, which indicates which method must be used to compress the archive.
13 14 15 16 17 18 |
# File 'lib/nucleus/core/common/files/archiver.rb', line 13 def compress(path, compression_format) compression_method = compression_format.downcase.gsub(/\./, '_').underscore.to_sym fail StandardError, "Unsupported compression format #{compression_format}" unless self.respond_to?(compression_method, true) send(compression_method, path) end |