Class: Backup::Configuration::Base
- Extended by:
- Attributes
- Defined in:
- lib/backup/configuration/base.rb
Instance Attribute Summary collapse
-
#adapter_name ⇒ Object
Returns the value of attribute adapter_name.
-
#after_backup_block ⇒ Object
Returns the value of attribute after_backup_block.
-
#before_backup_block ⇒ Object
Returns the value of attribute before_backup_block.
-
#storage_name ⇒ Object
Returns the value of attribute storage_name.
-
#trigger ⇒ Object
Returns the value of attribute trigger.
Instance Method Summary collapse
- #adapter(adapter, &block) ⇒ Object
- #after_backup(&block) ⇒ Object
- #before_backup(&block) ⇒ Object
- #get_adapter_configuration ⇒ Object
- #get_storage_configuration ⇒ Object
-
#initialize(trigger) ⇒ Base
constructor
A new instance of Base.
- #initialize_record ⇒ Object
-
#initialize_storage(adapter) ⇒ Object
Initializes the storing process depending on the store settings.
- #record_class ⇒ Object
- #storage(storage, &block) ⇒ Object
- #storage_class ⇒ Object
Methods included from Attributes
Constructor Details
#initialize(trigger) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 |
# File 'lib/backup/configuration/base.rb', line 9 def initialize(trigger) @trigger = trigger @adapter_configuration = Backup::Configuration::Adapter.new @storage_configuration = Backup::Configuration::Storage.new end |
Instance Attribute Details
#adapter_name ⇒ Object
Returns the value of attribute adapter_name.
7 8 9 |
# File 'lib/backup/configuration/base.rb', line 7 def adapter_name @adapter_name end |
#after_backup_block ⇒ Object
Returns the value of attribute after_backup_block.
7 8 9 |
# File 'lib/backup/configuration/base.rb', line 7 def after_backup_block @after_backup_block end |
#before_backup_block ⇒ Object
Returns the value of attribute before_backup_block.
7 8 9 |
# File 'lib/backup/configuration/base.rb', line 7 def before_backup_block @before_backup_block end |
#storage_name ⇒ Object
Returns the value of attribute storage_name.
7 8 9 |
# File 'lib/backup/configuration/base.rb', line 7 def storage_name @storage_name end |
#trigger ⇒ Object
Returns the value of attribute trigger.
7 8 9 |
# File 'lib/backup/configuration/base.rb', line 7 def trigger @trigger end |
Instance Method Details
#adapter(adapter, &block) ⇒ Object
15 16 17 18 |
# File 'lib/backup/configuration/base.rb', line 15 def adapter(adapter, &block) @adapter_name = adapter @adapter_configuration.instance_eval &block end |
#after_backup(&block) ⇒ Object
29 30 31 |
# File 'lib/backup/configuration/base.rb', line 29 def after_backup(&block) @after_backup_block = block end |
#before_backup(&block) ⇒ Object
25 26 27 |
# File 'lib/backup/configuration/base.rb', line 25 def before_backup(&block) @before_backup_block = block end |
#get_adapter_configuration ⇒ Object
66 67 68 |
# File 'lib/backup/configuration/base.rb', line 66 def get_adapter_configuration @adapter_configuration end |
#get_storage_configuration ⇒ Object
70 71 72 |
# File 'lib/backup/configuration/base.rb', line 70 def get_storage_configuration @storage_configuration end |
#initialize_record ⇒ Object
62 63 64 |
# File 'lib/backup/configuration/base.rb', line 62 def initialize_record record_class.new end |
#initialize_storage(adapter) ⇒ Object
Initializes the storing process depending on the store settings
58 59 60 |
# File 'lib/backup/configuration/base.rb', line 58 def initialize_storage(adapter) storage_class.new(adapter) end |
#record_class ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/backup/configuration/base.rb', line 45 def record_class case @storage_name.to_sym when :cloudfiles then Backup::Record::CloudFiles when :s3 then Backup::Record::S3 when :scp then Backup::Record::SCP when :ftp then Backup::Record::FTP when :sftp then Backup::Record::SFTP when :local then Backup::Record::Local when :dropbox then Backup::Record::Dropbox end end |
#storage(storage, &block) ⇒ Object
20 21 22 23 |
# File 'lib/backup/configuration/base.rb', line 20 def storage(storage, &block) @storage_name = storage @storage_configuration.instance_eval &block end |
#storage_class ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/backup/configuration/base.rb', line 33 def storage_class case @storage_name.to_sym when :cloudfiles then Backup::Storage::CloudFiles when :s3 then Backup::Storage::S3 when :scp then Backup::Storage::SCP when :ftp then Backup::Storage::FTP when :sftp then Backup::Storage::SFTP when :local then Backup::Storage::Local when :dropbox then Backup::Storage::Dropbox end end |