Class: Oddb2xml::FHIR::PreparationsParser
- Inherits:
-
Object
- Object
- Oddb2xml::FHIR::PreparationsParser
- Defined in:
- lib/oddb2xml/fhir_support.rb
Overview
Main parser class that provides compatibility with XML parser
Instance Attribute Summary collapse
-
#preparations ⇒ Object
readonly
Returns the value of attribute preparations.
Instance Method Summary collapse
-
#initialize(ndjson_file) ⇒ PreparationsParser
constructor
A new instance of PreparationsParser.
- #parse_file(ndjson_file) ⇒ Object
Constructor Details
#initialize(ndjson_file) ⇒ PreparationsParser
Returns a new instance of PreparationsParser.
420 421 422 423 |
# File 'lib/oddb2xml/fhir_support.rb', line 420 def initialize(ndjson_file) @preparations = [] parse_file(ndjson_file) end |
Instance Attribute Details
#preparations ⇒ Object (readonly)
Returns the value of attribute preparations.
418 419 420 |
# File 'lib/oddb2xml/fhir_support.rb', line 418 def preparations @preparations end |
Instance Method Details
#parse_file(ndjson_file) ⇒ Object
425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'lib/oddb2xml/fhir_support.rb', line 425 def parse_file(ndjson_file) File.foreach(ndjson_file, encoding: 'UTF-8') do |line| next if line.strip.empty? bundle = Bundle.new(line) next unless bundle.medicinal_product # Create a preparation structure compatible with XML parser output prep = create_preparation(bundle) @preparations << prep if prep end end |