Class: Backup::Compressor::Custom
- Defined in:
- lib/backup/compressor/custom.rb
Constant Summary
Constants included from Backup::CLI::Helpers
Instance Attribute Summary collapse
-
#command ⇒ Object
Specify the system command to invoke a compressor, including any command-line arguments.
-
#extension ⇒ Object
File extension to append to the compressed file’s filename.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Custom
constructor
Initializes a new custom compressor.
Methods inherited from Base
Methods included from Backup::Configuration::Helpers
Constructor Details
#initialize(&block) ⇒ Custom
Initializes a new custom compressor.
24 25 26 27 28 29 30 31 |
# File 'lib/backup/compressor/custom.rb', line 24 def initialize(&block) load_defaults! instance_eval(&block) if block_given? @cmd = set_cmd @ext = set_ext end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Backup::Configuration::Helpers
Instance Attribute Details
#command ⇒ Object
Specify the system command to invoke a compressor, including any command-line arguments. e.g. @compressor.command = ‘pbzip2 -p2 -4’
The data to be compressed will be piped to the command’s STDIN, and it should write the compressed data to STDOUT. i.e. ‘cat file.tar | %command% > file.tar.%extension%`
15 16 17 |
# File 'lib/backup/compressor/custom.rb', line 15 def command @command end |
#extension ⇒ Object
File extension to append to the compressed file’s filename. e.g. @compressor.extension = ‘.bz2’
20 21 22 |
# File 'lib/backup/compressor/custom.rb', line 20 def extension @extension end |