Class: ODDB::FiParse::Indications::Handler

Inherits:
Rpdf2txt::SimpleHandler
  • Object
show all
Defined in:
ext/fiparse/src/indications.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Handler) initialize

A new instance of Handler



13
14
15
16
17
18
19
# File 'ext/fiparse/src/indications.rb', line 13

def initialize
  super('')
  @iksnr = nil
  @indication = ''
  @indications = {}
  @news = []
end

Instance Attribute Details

- (Object) indications (readonly)

Returns the value of attribute indications



12
13
14
# File 'ext/fiparse/src/indications.rb', line 12

def indications
  @indications
end

- (Object) news (readonly)

Returns the value of attribute news



12
13
14
# File 'ext/fiparse/src/indications.rb', line 12

def news
  @news
end

Instance Method Details

- (Object) send_line_break



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'ext/fiparse/src/indications.rb', line 20

def send_line_break
  case @out
  when /^(\s*\*\s*)?Zul\.-Nr\.:\s*(\d{5})/u,
       /^(\s*\*\s*)?N.\s*d'AMM:\s*(\d{5})/u
    @iksnr = $~[2]
    @indication = ''
  when %r{^(\s*\*\s*)?Indica[tz]ion[eis]?:?\s*(.*)}u,
       %r{^(\s*\*\s*)?Anwendung(?:en)?:?\s*(.*)}u
    @indication << $~[2]
    @news.push(@iksnr) if(@iksnr && $~[1])
  when %r{^(\s*\*\s*)?Packung/en}u, %r{^(\s*\*\s*)?Conditionnements}u,
       %r{^(\s*\*\s*)?Confezione/i}u,
       %r{^(\s*\*\s*)?Bemerkung}u, %r{^(\s*\*\s*)?Remarque}u,
       %r{^(\s*\*\s*)?Osservazione/i}u
    if @iksnr && !@indication.empty?
      @indications.store @iksnr, @indication.strip
    end
    @iksnr = nil
    @indication = ''
  else
    @indication << @out unless @indication.empty?
  end
  @out = ''
end