模块 RSS::Atom::DuplicateLinkChecker
公共实例方法
validate_duplicate_links(链接) 点击切换源码
检查是否存在具有相同类型和 hreflang 属性,且 rel 属性为 alternate(或为空)的重复链接
如果发现重复项,则抛出 TooMuchTagError
异常
# File rss-0.3.1/lib/rss/atom.rb, line 249 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