Sha256: b6f16f45b95830d23af5333be1072bf863426d4699c5de0133773ddac12dcebc
Contents?: true
Size: 685 Bytes
Versions: 12
Compression:
Stored size: 685 Bytes
Contents
class BlogFeed attr_reader :pub_date, :items def initialize(feed) first = feed.first if first first_date = first.posted_at else first_date = Time.now end @pub_date = first_date.localtime.strftime "%a, %d %b %Y %H:%M:00 %z" @items = feed.map do |item| BlogFeed::Item.new item end end class Item attr_reader :title, :content, :url_title, :pub_date def initialize(post) @title = post.title @content = Markdown.render post.content, :html_safe => false, :link_to_absolute => true @url_title = post.url_title @pub_date = post.posted_at.localtime.strftime "%a, %d %b %Y %H:%M:00 %z" end end end
Version data entries
12 entries across 12 versions & 1 rubygems