Module: Drudgery::Extractors

Defined in:
lib/drudgery.rb,
lib/drudgery/extractors/csv_extractor.rb,
lib/drudgery/extractors/sqlite3_extractor.rb,
lib/drudgery/extractors/active_record_extractor.rb

Defined Under Namespace

Classes: ActiveRecordExtractor, CSVExtractor, SQLite3Extractor

Class Method Summary collapse

Class Method Details

.instantiate(type, *args) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/drudgery.rb', line 39

def self.instantiate(type, *args)
  case type
  when :csv
    extractor = Drudgery::Extractors::CSVExtractor
  when :sqlite3
    extractor = Drudgery::Extractors::SQLite3Extractor
  else
    extractor = Drudgery::Extractors.const_get("#{type.to_s.split('_').map(&:capitalize).join}Extractor")
  end

  extractor.new(*args)
end