Class: DataKeeper::Loader
- Inherits:
-
Object
- Object
- DataKeeper::Loader
- Includes:
- DatabaseConfig
- Defined in:
- lib/data_keeper/loader.rb
Defined Under Namespace
Classes: InflatedFiles
Instance Method Summary collapse
-
#initialize(dump, file) ⇒ Loader
constructor
A new instance of Loader.
- #load! ⇒ Object
Methods included from DatabaseConfig
#connection_args, #database, #database_connection_config, #docker_env_params, #dumper_connection_args, #dumper_psql_env, #host, #password, #port, #psql_env, #server_password, #server_port, #server_username, #username
Constructor Details
#initialize(dump, file) ⇒ Loader
Returns a new instance of Loader.
7 8 9 10 11 12 13 |
# File 'lib/data_keeper/loader.rb', line 7 def initialize(dump, file) @dump = dump @file = file @psql_version = build_terrapin_command('psql', '--version').run .match(/[0-9]{1,}\.[0-9]{1,}/) .to_s.to_f end |
Instance Method Details
#load! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/data_keeper/loader.rb', line 15 def load! if @dump.type == :full load_full_database! else load_partial_database! end if @dump.on_after_load_block ActiveRecord::Base.establish_connection @dump.on_after_load_block.call end end |