Class: NcsNavigator::Warehouse::Transformers::SamplingUnits
- Inherits:
-
Object
- Object
- NcsNavigator::Warehouse::Transformers::SamplingUnits
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/ncs_navigator/warehouse/transformers/sampling_units.rb
Overview
An enumerator that yields the sampling unit records implied by the
current NcsNavigator::Configuration
.
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Class Method Summary collapse
Instance Method Summary collapse
- #each {|create_study_center| ... } ⇒ Object
-
#initialize(config) ⇒ SamplingUnits
constructor
A new instance of SamplingUnits.
Constructor Details
#initialize(config) ⇒ SamplingUnits
Returns a new instance of SamplingUnits.
22 23 24 |
# File 'lib/ncs_navigator/warehouse/transformers/sampling_units.rb', line 22 def initialize(config) @configuration = config end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
15 16 17 |
# File 'lib/ncs_navigator/warehouse/transformers/sampling_units.rb', line 15 def configuration @configuration end |
Class Method Details
.create_transformer(config) ⇒ Object
18 19 20 |
# File 'lib/ncs_navigator/warehouse/transformers/sampling_units.rb', line 18 def self.create_transformer(config) EnumTransformer.new(config, new(config)) end |
Instance Method Details
#each {|create_study_center| ... } ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ncs_navigator/warehouse/transformers/sampling_units.rb', line 26 def each log.info("Generating MDES records for sampling units.") shell_describe('Study Center', 1) yield create_study_center shell_describe('PSU', configuration.navigator.psus.size) configuration.navigator.psus.each do |nav_psu| yield create_psu(nav_psu) end shell_describe('SSU', configuration.navigator.ssus.size) configuration.navigator.ssus.each do |nav_ssu| yield create_ssu(nav_ssu) end tsus = configuration.navigator.ssus.collect { |nav_ssu| nav_ssu.tsus }.flatten shell_describe('TSU', tsus.size) tsus.each do |nav_tsu| yield create_tsu(nav_tsu) end log.info("Sampling unit records complete.") shell.clear_line_then_say("Sampling unit records complete.\n") end |