Class: HealthDataStandards::Import::CDA::EntryFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/health-data-standards/import/cda/entry_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(entry_xpath) ⇒ EntryFinder

Returns a new instance of EntryFinder.



5
6
7
# File 'lib/health-data-standards/import/cda/entry_finder.rb', line 5

def initialize(entry_xpath)
  @entry_xpath = entry_xpath
end

Instance Method Details

#entries(doc) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/health-data-standards/import/cda/entry_finder.rb', line 9

def entries(doc)
  entry_elements = doc.xpath(@entry_xpath)
  if block_given?
    entry_elements.each do |entry_element|
      yield entry_element
    end
  else
    entry_elements
  end
end