Class: ODDB::LppvWriter

Inherits:
NullWriter show all
Defined in:
src/plugin/lppv.rb

Instance Method Summary (collapse)

Methods inherited from NullWriter

#new_fonthandler, #new_linkhandler, #send_image, #send_meta

Constructor Details

- (LppvWriter) initialize

A new instance of LppvWriter



13
14
15
16
# File 'src/plugin/lppv.rb', line 13

def initialize
  super
  @tables = []
end

Instance Method Details

- (Object) new_tablehandler(table)



17
18
19
20
21
22
# File 'src/plugin/lppv.rb', line 17

def new_tablehandler(table)
  if(table)
    @tables.push(table) unless(@tables.include?(table))
  end
  @table = table
end

- (Object) prices



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'src/plugin/lppv.rb', line 23

def prices
  prices = {}
  pcode_style = /[0-9]{6,8}/u
  price_style = /\d+\.\d\d/u
  @tables.at(1).each_row { |row|
    if(pcode_style.match(row.cdata(3)) \
       && price_style.match(row.cdata(5)))
      price = Util::Money.new(row.cdata(5).to_f, :public, 'CH')
      price.authority = :lppv
      prices.store(row.cdata(3).to_i.to_s, price)
    end
  }
  prices
end

- (Object) send_flowing_data(data)



37
38
39
40
41
# File 'src/plugin/lppv.rb', line 37

def send_flowing_data(data)
  if(@table)
    @table.send_cdata(data) 
  end
end