<< Masa.20111123-setup-script-ruby193-oddb_org | 2011 | Masa.20111121-importer-ruby193-slowsearch-bottleneck-oddb_org >>
Experiment
def price_exfactory(model, session)
'price_exfactory'
end
def price_public(model, session)
'price_public'
end
Result
Note
Experiment
def get_currency_rate(symbol)
#ODDB::Currency.rate('CHF', symbol)
1.0
end
Result
Note
Experiment
ch.oddb> get_currency_rate('CHF')
-> 1.0
ch.oddb> get_currency_rate('EUR')
->
ch.oddb> get_currency_rate('EUR')
->
ch.oddb> get_currency_rate('EUR').class
-> NilClass
ch.oddb> get_currency_rate('USD')
->
ch.oddb> get_currency_rate('USD')
->
ch.oddb> get_currency_rate('USD').class
-> NilClass
Note
Commit
module EBPS
module Decorator
module JustMedical
def self.decorate model
model.chapters.each_with_index do |chap, i|
if chap.heading =~ /Zulassungsinhaberin/
if chap.paragraphs.first.to_s =~ /AstraZeneca AG/
table = Text::Table.new
table.rows[0][0] = Text::LinkedParagraph.new('http://www.astrazeneca.ch/', 'AstraZeneca AG')
table.rows[0] << Text::Paragraph.new(chap.paragraphs.first.to_s.gsub(/AstraZeneca AG/,''))
chap.paragraphs[0] = table
end
end
end
title = if match = model.title.split.first.match(/(\w+)/)
match[1]
end
if codes = model.metadata['article_codes']
size_ean13s = codes.collect do |hash| [hash[:article_size], hash[:article_dose], hash[:article_ean13]] end.compact
unless size_ean13s.empty?
chapter = Text::Chapter.new
chapter.heading << 'Stammdaten'
size_ean13s.each do |size, dose, ean13|
reg = ean13[4,5]
href = if title
"http://www.med-drugs.ch/?main=/de/just-medical/search/zone/drugs/search_query/#{title.to_s}"
else
"http://www.med-drugs.ch"
end
chapter.add_paragraph Text::LinkedParagraph.new(href, model.title + " " + size.to_s + " " + dose.to_s)
end
model.add_chapter chapter
end
end
end
end
end
end