lib/atom/feed.rb in atom-tools-0.9.4 vs lib/atom/feed.rb in atom-tools-1.0.0

- old
+ new

@@ -71,11 +71,15 @@ if xml.respond_to? :to_atom_entry xml.to_atom_feed(base) elsif xml.respond_to? :read self.parse(xml.read) else - REXML::Document.new(xml.to_s).to_atom_feed(base) + begin + REXML::Document.new(xml.to_s).to_atom_feed(base) + rescue REXML::ParseException + raise Atom::ParseError + end end end # Create a new Feed that can be found at feed_uri and retrieved # using an Atom::HTTP object http @@ -94,10 +98,14 @@ # iterates over a feed's entries def each &block @entries.each &block end + def empty? + @entries.empty? + end + # gets everything in the logical feed (could be a lot of stuff) # (see <http://www.ietf.org/internet-drafts/draft-nottingham-atompub-feed-history-05.txt>) def get_everything! self.update! @@ -128,10 +136,10 @@ end end # like #merge, but in place def merge! other_feed - [:id, :title, :subtitle, :updated, :rights].each { |p| + [:id, :title, :subtitle, :updated, :rights, :logo, :icon].each { |p| self.send("#{p}=", other_feed.send("#{p}")) } [:links, :categories, :authors, :contributors].each do |p| other_feed.send("#{p}").each do |e|