Class: Backup::Compressor::Pbzip2
- Defined in:
- lib/backup/compressor/pbzip2.rb
Constant Summary
Constants included from Backup::CLI::Helpers
Instance Attribute Summary collapse
-
#best ⇒ Object
Tells Backup::Compressor::Pbzip2 to compress better (-9) rather than faster when set to true.
-
#fast ⇒ Object
Tells Backup::Compressor::Pbzip2 to compress faster (-1) rather than better when set to true.
-
#processors ⇒ Object
Tells Backup::Compressor::Pbzip2 how many processors use, by default autodetect is used.
Instance Method Summary collapse
-
#compress_with {|"#{ utility(:pbzip2) }#{ options }", '.bz2'| ... } ⇒ Object
Yields to the block the compressor command with options and it’s filename extension.
-
#initialize(&block) ⇒ Pbzip2
constructor
Creates a new instance of Backup::Compressor::Pbzip2 and configures it to either compress faster or better bzip2 compresses by default with -9 (best compression) and lower block sizes don’t make things significantly faster (according to official bzip2 docs).
Methods included from Backup::Configuration::Helpers
#clear_defaults!, #load_defaults!
Methods included from Backup::CLI::Helpers
#command_name, #raise_if_command_failed!, #run, #utility
Constructor Details
#initialize(&block) ⇒ Pbzip2
Creates a new instance of Backup::Compressor::Pbzip2 and configures it to either compress faster or better bzip2 compresses by default with -9 (best compression) and lower block sizes don’t make things significantly faster (according to official bzip2 docs)
28 29 30 31 32 33 34 35 36 |
# File 'lib/backup/compressor/pbzip2.rb', line 28 def initialize(&block) super @best ||= false @fast ||= false @processors ||= false instance_eval(&block) if block_given? end |
Instance Attribute Details
#best ⇒ Object
Tells Backup::Compressor::Pbzip2 to compress better (-9) rather than faster when set to true
10 11 12 |
# File 'lib/backup/compressor/pbzip2.rb', line 10 def best @best end |
#fast ⇒ Object
Tells Backup::Compressor::Pbzip2 to compress faster (-1) rather than better when set to true
15 16 17 |
# File 'lib/backup/compressor/pbzip2.rb', line 15 def fast @fast end |
#processors ⇒ Object
Tells Backup::Compressor::Pbzip2 how many processors use, by default autodetect is used
20 21 22 |
# File 'lib/backup/compressor/pbzip2.rb', line 20 def processors @processors end |
Instance Method Details
#compress_with {|"#{ utility(:pbzip2) }#{ options }", '.bz2'| ... } ⇒ Object
Yields to the block the compressor command with options and it’s filename extension.
41 42 43 44 |
# File 'lib/backup/compressor/pbzip2.rb', line 41 def compress_with log! yield "#{ utility(:pbzip2) }#{ options }", '.bz2' end |