Sha256: f2b85ce4eb46141961455728e6aca41ef8467f33da24a0b5facc9721d6adb443

Contents?: true

Size: 536 Bytes

Versions: 3

Compression:

Stored size: 536 Bytes

Contents

class BlogFeed
  attr_reader :pub_date, :items

  def initialize(feed)
    @pub_date = feed.first.posted_at.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, false
      @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

3 entries across 3 versions & 1 rubygems

Version Path
cartoonist-blog-0.0.6 app/models/blog_feed.rb
cartoonist-blog-0.0.5 app/models/blog_feed.rb
cartoonist-blog-0.0.4 app/models/blog_feed.rb