Class: NcsNavigator::Warehouse::Transformers::VdrXml
- Inherits:
-
Object
- Object
- NcsNavigator::Warehouse::Transformers::VdrXml
- Defined in:
- lib/ncs_navigator/warehouse/transformers/vdr_xml.rb,
lib/ncs_navigator/warehouse/transformers/vdr_xml/reader.rb
Defined Under Namespace
Classes: Reader
Class Method Summary collapse
-
.from_file(config, filename, options = {}) ⇒ #transform
A transformer that loads the MDES data in the specified VDR XML file.
-
.from_most_recent_file(config, list, options = {}) ⇒ #transform
A transformer for the most recently modified VDR XML file from the given list of files.
Class Method Details
.from_file(config, filename, options = {}) ⇒ #transform
Returns a transformer that loads the MDES data in the specified VDR XML file.
11 12 13 |
# File 'lib/ncs_navigator/warehouse/transformers/vdr_xml.rb', line 11 def from_file(config, filename, ={}) # <- TODO better solution EnumTransformer.new(config, Reader.new(config, filename), ) end |
.from_most_recent_file(config, list, options = {}) ⇒ #transform
Returns a transformer for the most recently modified VDR XML file from the given list of files.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ncs_navigator/warehouse/transformers/vdr_xml.rb', line 25 def from_most_recent_file(config, list, ={}) files = if String === list Dir[list].tap { |a| fail "Glob #{list} does not match any files." if a.empty? } else list.tap { |a| fail "The file list is empty." if a.empty? } end from_file( config, files.collect { |fn| [fn, File.stat(fn).mtime] }. sort_by { |fn, mtime| mtime }.reverse.first.first, ) end |