Class: BlogFeed
- Inherits:
-
Object
- Object
- BlogFeed
- Defined in:
- app/models/blog_feed.rb
Defined Under Namespace
Classes: Item
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#pub_date ⇒ Object
readonly
Returns the value of attribute pub_date.
Instance Method Summary collapse
-
#initialize(feed) ⇒ BlogFeed
constructor
A new instance of BlogFeed.
Constructor Details
#initialize(feed) ⇒ BlogFeed
Returns a new instance of BlogFeed.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/models/blog_feed.rb', line 4 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 |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
2 3 4 |
# File 'app/models/blog_feed.rb', line 2 def items @items end |
#pub_date ⇒ Object (readonly)
Returns the value of attribute pub_date.
2 3 4 |
# File 'app/models/blog_feed.rb', line 2 def pub_date @pub_date end |