Class: QRDA::Cat1::EntryFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/qrda-import/entry_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(entry_xpath) ⇒ EntryFinder

Returns a new instance of EntryFinder.



4
5
6
# File 'lib/qrda-import/entry_finder.rb', line 4

def initialize(entry_xpath)
  @entry_xpath = entry_xpath
end

Instance Method Details

#entries(doc) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/qrda-import/entry_finder.rb', line 8

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