Class: Backup::Package
- Inherits:
-
Object
- Object
- Backup::Package
- Defined in:
- lib/backup/package.rb
Instance Attribute Summary collapse
-
#chunk_suffixes ⇒ Object
Set by the Splitter if the final archive was “chunked”.
-
#extension ⇒ Object
Extension for the final archive file(s).
-
#no_cycle ⇒ Object
If true, the Cycler will not attempt to remove the package when Cycling.
-
#time ⇒ Object
The time when the backup initiated (in format: 2011.02.20.03.29.59).
-
#trigger ⇒ Object
readonly
The trigger which initiated the backup process.
-
#version ⇒ Object
readonly
The version of Backup used to create the package.
Instance Method Summary collapse
- #basename ⇒ Object
- #filenames ⇒ Object
-
#initialize(model) ⇒ Package
constructor
A new instance of Package.
- #time_as_object ⇒ Object
Constructor Details
#initialize(model) ⇒ Package
Returns a new instance of Package.
27 28 29 30 31 32 33 |
# File 'lib/backup/package.rb', line 27 def initialize(model) @trigger = model.trigger @extension = "tar" @chunk_suffixes = [] @no_cycle = false @version = VERSION end |
Instance Attribute Details
#chunk_suffixes ⇒ Object
Set by the Splitter if the final archive was “chunked”
17 18 19 |
# File 'lib/backup/package.rb', line 17 def chunk_suffixes @chunk_suffixes end |
#extension ⇒ Object
Extension for the final archive file(s)
13 14 15 |
# File 'lib/backup/package.rb', line 13 def extension @extension end |
#no_cycle ⇒ Object
If true, the Cycler will not attempt to remove the package when Cycling.
21 22 23 |
# File 'lib/backup/package.rb', line 21 def no_cycle @no_cycle end |
#time ⇒ Object
The time when the backup initiated (in format: 2011.02.20.03.29.59)
5 6 7 |
# File 'lib/backup/package.rb', line 5 def time @time end |
#trigger ⇒ Object (readonly)
The trigger which initiated the backup process
9 10 11 |
# File 'lib/backup/package.rb', line 9 def trigger @trigger end |
#version ⇒ Object (readonly)
The version of Backup used to create the package
25 26 27 |
# File 'lib/backup/package.rb', line 25 def version @version end |
Instance Method Details
#basename ⇒ Object
43 44 45 |
# File 'lib/backup/package.rb', line 43 def basename "#{trigger}.#{extension}" end |
#filenames ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/backup/package.rb', line 35 def filenames if chunk_suffixes.empty? [basename] else chunk_suffixes.map { |suffix| "#{basename}-#{suffix}" } end end |
#time_as_object ⇒ Object
47 48 49 |
# File 'lib/backup/package.rb', line 47 def time_as_object Time.strptime(time, "%Y.%m.%d.%H.%M.%S") end |