Sha256: 896a99042265dac7f783683c089ca5f0546fae13465aecb2212e34ef9c7f52c6
Contents?: true
Size: 793 Bytes
Versions: 39
Compression:
Stored size: 793 Bytes
Contents
module QRDA module Cat1 class NarrativeReferenceHandler def initialize @id_map = {} end def build_id_map(doc) path = "//*[@ID]" ids = doc.xpath(path) ids.each do |id| tag = id['ID'] value = id.content @id_map[tag] = value end end # @param [String] tag # @return [String] text description of tag def lookup_tag(tag) value = @id_map[tag] # Not sure why, but sometimes the reference is #<Reference> and the ID value is <Reference>, and # sometimes it is #<Reference>. We look for both. if !value and tag[0] == '#' tag = tag[1,tag.length] value = @id_map[tag] end value end end end end
Version data entries
39 entries across 39 versions & 2 rubygems