Class: ComicFeed
- Inherits:
-
Object
- Object
- ComicFeed
- Defined in:
- app/models/comic_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) ⇒ ComicFeed
constructor
A new instance of ComicFeed.
Constructor Details
#initialize(feed) ⇒ ComicFeed
Returns a new instance of ComicFeed.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/models/comic_feed.rb', line 4 def initialize(feed) first = feed.first if first first_date = first.posted_at else first_date = Date.today end @pub_date = first_date.to_time.strftime "%a, %d %b %Y 00:00:01 %z" @items = feed.map do |item| ComicFeed::Item.new item end end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
2 3 4 |
# File 'app/models/comic_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/comic_feed.rb', line 2 def pub_date @pub_date end |