Class: FaviconCheck

Inherits:
HTML::Proofer::CheckRunner show all
Defined in:
lib/html/proofer/checks/favicon.rb

Instance Attribute Summary

Attributes inherited from HTML::Proofer::CheckRunner

#alt_ignores, #empty_alt_ignore, #external_urls, #href_ignores, #hydra_opts, #issues, #options, #parallel_opts, #path, #src, #typhoeus_opts, #url_ignores, #validation_opts

Instance Method Summary collapse

Methods inherited from HTML::Proofer::CheckRunner

#add_issue, #add_path_for_url, #add_to_external_urls, checks, #extract_domain_path, #initialize, #new_url_query_values?

Constructor Details

This class inherits a constructor from HTML::Proofer::CheckRunner

Instance Method Details

#runObject


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/html/proofer/checks/favicon.rb', line 8

def run
  found = false
  @html.xpath('//link[not(ancestor::pre or ancestor::code)]').each do |node|
    favicon = FaviconCheckable.new(node, self)
    next if favicon.ignore?
    found = true if favicon.rel.split(' ').last.eql? 'icon'
    break if found
  end

  return if found

  add_issue 'no favicon specified'
end