Class: Cline::Collectors::Feed
- Defined in:
- lib/cline/collectors/feed.rb
Class Method Summary collapse
Instance Method Summary collapse
- #entries ⇒ Object
-
#initialize(opml_str) ⇒ Feed
constructor
A new instance of Feed.
Methods inherited from Base
Constructor Details
#initialize(opml_str) ⇒ Feed
Returns a new instance of Feed.
21 22 23 24 25 26 27 |
# File 'lib/cline/collectors/feed.rb', line 21 def initialize(opml_str) require 'rexml/document' require 'active_support/deprecation' require 'feedzirra' @opml = REXML::Document.new(opml_str) end |
Class Method Details
.collect ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/cline/collectors/feed.rb', line 8 def collect new(opml_path.read).entries.each do |entry| = Cline::Notification.("#{entry.title} #{entry.url}") create_or_pass , entry.published end end |
Instance Method Details
#entries ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cline/collectors/feed.rb', line 29 def entries feed_urls = parse_opml(@opml.elements['opml/body']) entries = [] 3.times.map { Thread.fork { while url = feed_urls.pop entries += fetch_entries(url) end Thread.pass } }.map(&:join) entries end |