Sha256: 493b23d0e4920543b175b1967a6428acfd7f18d85190d8862eb164937856f937

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

module Smoke
  # Feed can take multiple rss or atom feeds and munge them up together.
  # 
  # Usage:
  #   Smoke.feed(:ruby) do
  #     url "domain.tld/rss"
  #     url "site.tld/atom"
  #   end
  class Feed < Origin
    attr_reader :requests
    
    def url(feed_uri)
      (@feeds ||= [] ) << feed_uri
    end
    
    protected
    def dispatch
      @requests = @feeds.map{|f| Smoke::Request.new(f, {:raw_response => true}) }
      self.items = @requests.map{|r| ::SimpleRSS.parse(r.body).items }.flatten
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smoke-0.5.20 lib/smoke/source/feed.rb
smoke-0.5.19 lib/smoke/source/feed.rb
smoke-0.5.17 lib/smoke/source/feed.rb