Class: ODDB::BsvXmlPlugin::GenericsListener

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)



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'src/plugin/bsv_xml.rb', line 79

def tag_end name
  case name
  when 'GenGroupOrg'
    @pointer = Persistence::Pointer.new [:generic_group, @text]
  when 'PharmacodeOrg'
    @original = Package.find_by_pharmacode(@text)
  when 'PharmacodeGen'
    @generic = Package.find_by_pharmacode(@text)
  when 'OrgGen'
    if @pointer && @original && @generic
      group = @app.create @pointer
      @app.update @original.pointer, {:generic_group => @pointer}, :bag
      @app.update @generic.pointer, {:generic_group => @pointer}, :bag
    end
    @pointer, @original, @generic = nil
  end
  @html, @text = nil
end

- (Object) tag_start(name, attrs)



75
76
77
78
# File 'src/plugin/bsv_xml.rb', line 75

def tag_start name, attrs
  @text = ''
  @html = ''
end