# coding: utf-8 require 'mustache' class BookRanking < Mustache # <> # url: AmazonのURL # title: 書名 # src: 書影ファイル名 # desc: 説明 @template = <
{{title}}

 {{& description}}

EOT def description Mustache.new.render(desc, {book: "『[#{title}](#{url})』"}) end def cover case File.dirname(src) when ".", "images" f = File.basename(src) "/static/images/article/■記事ID■/#{/^\d+_/ =~ f ? f : '■記事ID■_' + f}" when "common" "/static/images/article/common/#{File.basename(src)}" else src end end end