Method: Mabmapper::MabXml::Document#controlfield
- Defined in:
- lib/mabmapper/mab_xml/document.rb
#controlfield(name) ⇒ Object
Returns the contents of a MAB control field as an array.
21 22 23 24 25 |
# File 'lib/mabmapper/mab_xml/document.rb', line 21 def controlfield(name) xpath = "//controlfield[@tag='#{name}']" result = @xml.at_xpath(xpath).try(:text) result.present? ? result.chars.to_a.map{|e| (e=='|') ? nil : e} : [] end |