Class: ODDB::BsvXmlPlugin::ItCodesListener

Inherits:
Listener show all
Defined in:
src/plugin/bsv_xml.rb

Constant Summary

Constants inherited from Listener

FORMATS

Instance Method Summary (collapse)

Methods inherited from Listener

#date, #initialize, #text, #time, #update_chapter

Constructor Details

This class inherits a constructor from ODDB::BsvXmlPlugin::Listener

Instance Method Details

- (Object) tag_end(name)



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'src/plugin/bsv_xml.rb', line 112

def tag_end name
  case name
  when 'ItCode'
    @app.update @pointer.creator, @data, :bag
    unless @lim_data.empty?
      lim_ptr = @pointer + :limitation_text
      @lim_data.each_key do |key|
        if key.to_s.size == 2
          chp = Text::Chapter.new
          update_chapter chp, @lim_data[key]
          @lim_data[key] = chp
        end
      end
      @app.update lim_ptr.creator, @lim_data, :bag
    end
  when /Limitation([A-Z].+)/u, /Description(..)/u
    @target_data.store $~[1].downcase.to_sym, @text
  when 'ValidFromDate'
    @target_data.store :valid_from, date(@text)
  when 'Points'
    @target_data.store :limitation_points, @text.to_i
  end
  @text, @html = nil
end

- (Object) tag_start(name, attrs)



99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'src/plugin/bsv_xml.rb', line 99

def tag_start name, attrs
  case name
  when 'ItCode'
    code = attrs['Code'].to_s
    @pointer = Persistence::Pointer.new [:index_therapeuticus, code]
    @target_data = @data = {}
  when 'Limitations'
    @target_data = @lim_data = {}
  else
    @text = ''
    @html = ''
  end
end