Class: Rss2Html::Feed
- Inherits:
-
Object
- Object
- Rss2Html::Feed
- Defined in:
- lib/rss2html/feed.rb
Instance Attribute Summary collapse
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(args) ⇒ Feed
constructor
A new instance of Feed.
- #render ⇒ Object
Constructor Details
#initialize(args) ⇒ Feed
Returns a new instance of Feed.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rss2html/feed.rb', line 26 def initialize(args) @title = args['title'] @url = args['url'] limit = args['limit'] if limit @url += "&limit=#{limit}" end @feed_header = load_template('feed_header.html.erb') @feed_footer = load_template('feed_footer.html.erb') @item_template = load_template('item.html.erb') end |
Instance Attribute Details
#title ⇒ Object (readonly)
Returns the value of attribute title.
24 25 26 |
# File 'lib/rss2html/feed.rb', line 24 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
24 25 26 |
# File 'lib/rss2html/feed.rb', line 24 def url @url end |
Instance Method Details
#fetch ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/rss2html/feed.rb', line 39 def fetch open(@url) do |rss| feed = RSS::Parser.parse(rss) feed.entries.each do |item| yield item end end end |