Class: Backup::Compressor::Gzip

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#log!

Methods included from Backup::Configuration::Helpers

#clear_defaults!, #getter_methods, #load_defaults!, #setter_methods

Methods included from Backup::CLI

#mkdir, #rm, #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)
  load_defaults!

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

  instance_eval(&block) if block_given?
end

Instance Attribute Details

#best=(value) ⇒ Object

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=(value)
  @best = value
end

#fast=(value) ⇒ Object

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=(value)
  @fast = value
end

Instance Method Details

#perform!Object

Performs the compression of the packages backup file



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

def perform!
  log!
  run("#{ utility(:gzip) } #{ options } '#{ Backup::Model.file }'")
  Backup::Model.extension += '.gz'
end