lib/feedjira/parser/atom.rb in feedjira-3.1.1 vs lib/feedjira/parser/atom.rb in feedjira-3.1.2

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Feedjira module Parser # Parser for dealing with Atom feeds. class Atom include SAXMachine @@ -12,10 +14,10 @@ elements :link, as: :links, value: :href elements :link, as: :hubs, value: :href, with: { rel: "hub" } elements :entry, as: :entries, class: AtomEntry def self.able_to_parse?(xml) - %r{\<feed[^\>]+xmlns\s?=\s?[\"\'](http://www\.w3\.org/2005/Atom|http://purl\.org/atom/ns\#)[\"\'][^\>]*\>} =~ xml # rubocop:disable Metrics/LineLength + %r{<feed[^>]+xmlns\s?=\s?["'](http://www\.w3\.org/2005/Atom|http://purl\.org/atom/ns\#)["'][^>]*>} =~ xml end def url @url || (links - [feed_url]).last || links.last end