Class: Laika::Blog
- Inherits:
-
Object
- Object
- Laika::Blog
- Defined in:
- lib/laika/blog.rb
Instance Attribute Summary collapse
-
#feed ⇒ Object
readonly
Returns the value of attribute feed.
Instance Method Summary collapse
- #get_new_entries ⇒ Object
-
#initialize(url) ⇒ Blog
constructor
A new instance of Blog.
Constructor Details
#initialize(url) ⇒ Blog
Returns a new instance of Blog.
9 10 11 12 |
# File 'lib/laika/blog.rb', line 9 def initialize(url) @url = url @seen_ids = [] end |
Instance Attribute Details
#feed ⇒ Object (readonly)
Returns the value of attribute feed.
7 8 9 |
# File 'lib/laika/blog.rb', line 7 def feed @feed end |
Instance Method Details
#get_new_entries ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/laika/blog.rb', line 14 def get_new_entries @feed = FeedNormalizer::FeedNormalizer.parse(open(@url)) feed_ids = @feed.entries.collect{|e| e.id} new_ids = feed_ids - @seen_ids @seen_ids += new_ids @feed.entries.select{|e| new_ids.include?(e.id)} end |