Class: Backup::Storage::Base

Inherits:
Object
  • Object
show all
Includes:
Configuration::Helpers
Defined in:
lib/backup/storage/base.rb

Direct Known Subclasses

CloudFiles, Dropbox, FTP, Local, Ninefold, RSync, S3, SCP, SFTP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configuration::Helpers

included

Constructor Details

#initialize(model, storage_id = nil) ⇒ Base

Creates a new instance of the storage object

  • Called with super(model, storage_id) from each subclass



23
24
25
26
27
# File 'lib/backup/storage/base.rb', line 23

def initialize(model, storage_id = nil)
  load_defaults!
  @model = model
  @storage_id = storage_id
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backup::Configuration::Helpers

Instance Attribute Details

#keepObject

Sets the limit to how many backups to keep in the remote location. If exceeded, the oldest will be removed to make room for the newest



11
12
13
# File 'lib/backup/storage/base.rb', line 11

def keep
  @keep
end

#storage_idObject

(Optional) User-defined string used to uniquely identify multiple storages of the same type. This will be appended to the YAML storage file used for cycling backups.



18
19
20
# File 'lib/backup/storage/base.rb', line 18

def storage_id
  @storage_id
end

Instance Method Details

#perform!Object

Performs the backup transfer



31
32
33
34
35
# File 'lib/backup/storage/base.rb', line 31

def perform!
  @package = @model.package
  transfer!
  cycle!
end