Class: Backup::Database::Base

Inherits:
Object
  • Object
show all
Includes:
Config::Helpers, Utilities::Helpers
Defined in:
lib/backup/database/base.rb

Direct Known Subclasses

MongoDB, MySQL, OpenLDAP, PostgreSQL, Redis, Riak, SQLite

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Config::Helpers

included

Constructor Details

#initialize(model, database_id = nil) ⇒ Base

If given, database_id will be appended to the #dump_filename. This is required if multiple Databases of the same class are added to the model.



17
18
19
20
21
22
# File 'lib/backup/database/base.rb', line 17

def initialize(model, database_id = nil)
  @model = model
  @database_id = database_id.to_s.gsub(/\W/, '_') if database_id
  @dump_path = File.join(Config.tmp_path, model.trigger, 'databases')
  load_defaults!
end

Dynamic Method Handling

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

Instance Attribute Details

#database_idObject (readonly)

Returns the value of attribute database_id.



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

def database_id
  @database_id
end

#dump_pathObject (readonly)

Returns the value of attribute dump_path.



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

def dump_path
  @dump_path
end

#modelObject (readonly)

Returns the value of attribute model.



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

def model
  @model
end

Instance Method Details

#perform!Object



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

def perform!
  log!(:started)
  prepare!
end