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

Version Path
cqm-reports-4.1.3 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-4.1.2 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-4.1.1 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-4.1.0 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-4.0.1 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.10 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.9 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-4.0.0 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.8 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.7 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.6 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.5 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.4 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.3 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-2.1.1 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-2.1.0 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.2 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.1 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.1.0 lib/qrda-import/narrative_reference_handler.rb
cqm-reports-3.0.1 lib/qrda-import/narrative_reference_handler.rb