Class: Snapshots::DatabaseLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/snapshots/database_loader.rb

Class Method Summary collapse

Instance Method Summary collapse

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