Module: Drudgery::Loaders

Defined in:
lib/drudgery.rb,
lib/drudgery/loaders/csv_loader.rb,
lib/drudgery/loaders/sqlite3_loader.rb,
lib/drudgery/loaders/active_record_loader.rb,
lib/drudgery/loaders/active_record_import_loader.rb

Defined Under Namespace

Classes: ActiveRecordImportLoader, ActiveRecordLoader, CSVLoader, SQLite3Loader

Class Method Summary collapse

Class Method Details

.instantiate(type, *args) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/drudgery.rb', line 54

def self.instantiate(type, *args)
  case type
  when :csv
    loader = Drudgery::Loaders::CSVLoader
  when :sqlite3
    loader = Drudgery::Loaders::SQLite3Loader
  else
    loader = Drudgery::Loaders.const_get("#{type.to_s.split('_').map(&:capitalize).join}Loader")
  end

  loader.new(*args)
end