Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (18 sloc) 0.426 kb
require 'rss'
require 'open-uri'
require 'celluloid'
class FeedCounter
include Celluloid
def count(url)
open(url) do |f|
rss = RSS::Parser.parse(f.read, false)
count = rss.items.size
puts "#{count} in #{url}"
count
end
end
end
pool = FeedCounter.pool(size: 6)
futures = $*.map { |url| pool.future(:count, url) }
total = futures.map(&:value).inject(:+)
puts "#{total} total" if total
Jump to Line
Something went wrong with that request. Please try again.