Class: Backup::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/backup/package.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Package

Returns a new instance of Package.



26
27
28
29
30
31
32
# File 'lib/backup/package.rb', line 26

def initialize(model)
  @time = model.time
  @trigger = model.trigger
  @extension = 'tar'
  @chunk_suffixes = Array.new
  @version = Backup::Version.current
end

Instance Attribute Details

#chunk_suffixesObject

Set by the Splitter if the final archive was “chunked”



20
21
22
# File 'lib/backup/package.rb', line 20

def chunk_suffixes
  @chunk_suffixes
end

#extensionObject

Extension for the final archive file(s)



16
17
18
# File 'lib/backup/package.rb', line 16

def extension
  @extension
end

#timeObject (readonly)

The time when the backup initiated (in format: 2011.02.20.03.29.59)



8
9
10
# File 'lib/backup/package.rb', line 8

def time
  @time
end

#triggerObject (readonly)

The trigger which initiated the backup process



12
13
14
# File 'lib/backup/package.rb', line 12

def trigger
  @trigger
end

#versionObject (readonly)

The version of Backup used to create the package



24
25
26
# File 'lib/backup/package.rb', line 24

def version
  @version
end

Instance Method Details

#basenameObject



42
43
44
# File 'lib/backup/package.rb', line 42

def basename
  "#{ time }.#{ trigger }.#{ extension }"
end

#filenamesObject



34
35
36
37
38
39
40
# File 'lib/backup/package.rb', line 34

def filenames
  if chunk_suffixes.empty?
    [basename]
  else
    chunk_suffixes.map {|suffix| "#{ basename }-#{ suffix }" }
  end
end