Class: Backup::Compressor::Gzip

Inherits:
Base
  • Object
show all
Defined in:
lib/backup/compressor/gzip.rb

Constant Summary

Constants included from Backup::CLI::Helpers

Backup::CLI::Helpers::UTILITY

Instance Attribute Summary collapse

Instance Method Summary collapse

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) ⇒ Gzip

Creates a new instance of Backup::Compressor::Gzip and configures it to either compress faster or better



20
21
22
23
24
25
26
27
# File 'lib/backup/compressor/gzip.rb', line 20

def initialize(&block)
  super

  @best ||= false
  @fast ||= false

  instance_eval(&block) if block_given?
end

Instance Attribute Details

#bestObject

Tells Backup::Compressor::Gzip to compress better rather than faster when set to true



10
11
12
# File 'lib/backup/compressor/gzip.rb', line 10

def best
  @best
end

#fastObject

Tells Backup::Compressor::Gzip to compress faster rather than better when set to true



15
16
17
# File 'lib/backup/compressor/gzip.rb', line 15

def fast
  @fast
end

Instance Method Details

#compress_with {|"#{ utility(:gzip) }#{ options }", '.gz'| ... } ⇒ Object

Yields to the block the compressor command with options and it’s filename extension.

Yields:

  • ("#{ utility(:gzip) }#{ options }", '.gz')


32
33
34
35
# File 'lib/backup/compressor/gzip.rb', line 32

def compress_with
  log!
  yield "#{ utility(:gzip) }#{ options }", '.gz'
end