Module: NcsNavigator::Warehouse::Transformers::MdesCsv
- Defined in:
- lib/ncs_navigator/warehouse/transformers/mdes_csv.rb,
lib/ncs_navigator/warehouse/transformers/mdes_csv/table_reader.rb,
lib/ncs_navigator/warehouse/transformers/mdes_csv/multiple_table_reader.rb
Defined Under Namespace
Classes: MultipleTableReader, TableReader
Class Method Summary collapse
-
.from_directory(configuration, directory, options = {}) ⇒ #transform
Creates a transformer that loads a directory full of CSV files, interpreting each of them using TableReader.
Class Method Details
.from_directory(configuration, directory, options = {}) ⇒ #transform
Creates a transformer that loads a directory full of CSV files,
interpreting each of them using TableReader. Files that do not have the
extension csv
are ignored; so are subdirectories.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ncs_navigator/warehouse/transformers/mdes_csv.rb', line 14 def self.from_directory(configuration, directory, ={}) readers = Dir["#{directory}/*.csv"].collect do |csv_file| model = File.basename(csv_file).sub(/\.csv$/, '') MdesCsv::TableReader.new(configuration, model, csv_file) end EnumTransformer.new( configuration, MdesCsv::MultipleTableReader.new(configuration, readers), ) end |