/var/ebps/bin/decorators/ch_oddb_de.rb
module ChOddb def self.decorate model if codes = model.metadata['article_codes'] #ean13s = codes.collect do |hash| hash[:article_ean13] end.compactsize_ean13s = codes.collect do |hash| [hash[:article_size], hash[:article_ean13]] end.compact
#unless ean13s.empty?unless size_ean13s.empty?
chapter = Text::Chapter.new chapter.heading << 'Preisvergleich' #ean13s.each do |ean13|size_ean13s.each do |size, ean13|
href = "http://ch.oddb.org/de/gcc/compare/ean13/#{ean13}" #chapter.add_paragraph Text::LinkedParagraph.new(href, ean13)chapter.add_paragraph Text::LinkedParagraph.new(href, model.title + " " + size.to_s + " " + ean13.to_s)
end model.add_chapter chapter end end end end
Note