Class: Snapshots::DatabaseLoader
- Inherits:
-
Object
- Object
- Snapshots::DatabaseLoader
- Defined in:
- lib/snapshots/database_loader.rb
Class Method Summary collapse
Instance Method Summary collapse
- #for_table(name, &proc) ⇒ Object
-
#initialize(connection) ⇒ DatabaseLoader
constructor
A new instance of DatabaseLoader.
- #load(&proc) ⇒ Object
Constructor Details
#initialize(connection) ⇒ DatabaseLoader
Returns a new instance of DatabaseLoader.
9 10 11 |
# File 'lib/snapshots/database_loader.rb', line 9 def initialize(connection) @connection = connection end |
Class Method Details
.load(connection = ActiveRecord::Base.connection, &proc) ⇒ Object
5 6 7 |
# File 'lib/snapshots/database_loader.rb', line 5 def self.load(connection=ActiveRecord::Base.connection, &proc) new(connection).load(&proc) end |
Instance Method Details
#for_table(name, &proc) ⇒ Object
17 18 19 |
# File 'lib/snapshots/database_loader.rb', line 17 def for_table(name, &proc) Snapshots::TableLoader.load(@connection, name, &proc) end |
#load(&proc) ⇒ Object
13 14 15 |
# File 'lib/snapshots/database_loader.rb', line 13 def load(&proc) instance_eval(&proc) end |