Class: Backup::Compressor::Custom
- Defined in:
- lib/backup/compressor/custom.rb
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::Config::Helpers
Constructor Details
#initialize(&block) ⇒ Custom
Initializes a new custom compressor.
21 22 23 24 25 26 27 28 |
# File 'lib/backup/compressor/custom.rb', line 21 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::Config::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%`
12 13 14 |
# File 'lib/backup/compressor/custom.rb', line 12 def command @command end |
#extension ⇒ Object
File extension to append to the compressed file’s filename. e.g. @compressor.extension = ‘.bz2’
17 18 19 |
# File 'lib/backup/compressor/custom.rb', line 17 def extension @extension end |