lib/feedjira/parser/rss.rb in feedjira-2.0.0 vs lib/feedjira/parser/rss.rb in feedjira-2.1.0
- old
+ new
@@ -1,24 +1,26 @@
module Feedjira
-
module Parser
# Parser for dealing with RSS feeds.
+ # Source: https://cyber.harvard.edu/rss/rss.html
class RSS
include SAXMachine
include FeedUtilities
+ element :description
+ element :image, class: RSSImage
+ element :language
+ element :lastBuildDate, as: :last_built
+ element :link, as: :url
element :rss, as: :version, value: :version
element :title
- element :description
- element :link, :as => :url
- elements :item, :as => :entries, :class => RSSEntry
- elements :"atom:link", :as => :hubs, :value => :href, :with => {:rel => "hub"}
+ element :ttl
+ elements :"atom:link", as: :hubs, value: :href, with: { rel: 'hub' }
+ elements :item, as: :entries, class: RSSEntry
attr_accessor :feed_url
- def self.able_to_parse?(xml) #:nodoc:
+ def self.able_to_parse?(xml)
(/\<rss|\<rdf/ =~ xml) && !(/feedburner/ =~ xml)
end
end
-
end
-
end