Module: RSS::Atom::DuplicateLinkChecker
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/rss/atom.rb |
Instance Method Summary
-
#validate_duplicate_links(links)
Checks if there are duplicate links with the same type and hreflang attributes that have an alternate (or empty) rel attribute.
Instance Method Details
#validate_duplicate_links(links)
Checks if there are duplicate links with the same type and hreflang attributes that have an alternate (or empty) rel attribute
Raises a ::RSS::TooMuchTagError if there are duplicates found
# File 'lib/rss/atom.rb', line 234
def validate_duplicate_links(links) link_infos = {} links.each do |link| rel = link.rel || "alternate" next unless rel == "alternate" key = [link.hreflang, link.type] if link_infos.has_key?(key) raise TooMuchTagError.new("link", tag_name) end link_infos[key] = true end end