Class: NcsNavigator::Warehouse::Transformers::MdesCsv::MultipleTableReader
- Inherits:
-
Object
- Object
- NcsNavigator::Warehouse::Transformers::MdesCsv::MultipleTableReader
- Includes:
- Enumerable
- Defined in:
- lib/ncs_navigator/warehouse/transformers/mdes_csv/multiple_table_reader.rb
Overview
An enumerable that joins the results for several TableReaders into a single #each call.
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#table_readers ⇒ Object
readonly
Returns the value of attribute table_readers.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(configuration, table_readers) ⇒ MultipleTableReader
constructor
A new instance of MultipleTableReader.
- #name ⇒ Object
Constructor Details
#initialize(configuration, table_readers) ⇒ MultipleTableReader
Returns a new instance of MultipleTableReader.
15 16 17 18 |
# File 'lib/ncs_navigator/warehouse/transformers/mdes_csv/multiple_table_reader.rb', line 15 def initialize(configuration, table_readers) @configuration = configuration @table_readers = table_readers.sort_by { |r| configuration.models_module.mdes_order.index(r.model) } end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
10 11 12 |
# File 'lib/ncs_navigator/warehouse/transformers/mdes_csv/multiple_table_reader.rb', line 10 def configuration @configuration end |
#table_readers ⇒ Object (readonly)
Returns the value of attribute table_readers.
10 11 12 |
# File 'lib/ncs_navigator/warehouse/transformers/mdes_csv/multiple_table_reader.rb', line 10 def table_readers @table_readers end |
Instance Method Details
#each ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/ncs_navigator/warehouse/transformers/mdes_csv/multiple_table_reader.rb', line 20 def each table_readers.each do |reader| reader.each do |record| yield record end end end |
#name ⇒ Object
28 29 30 |
# File 'lib/ncs_navigator/warehouse/transformers/mdes_csv/multiple_table_reader.rb', line 28 def name table_readers.collect(&:name).join(', ') end |