Class: HTML::Proofer::CheckRunner
- Inherits:
-
Object
- Object
- HTML::Proofer::CheckRunner
- Defined in:
- lib/html/proofer/check_runner.rb,
lib/html/proofer/check_runner/issue.rb
Overview
Mostly handles issue management and collecting of external URLs.
Direct Known Subclasses
Defined Under Namespace
Classes: Issue, SortedIssues
Instance Attribute Summary collapse
-
#allow_hash_href ⇒ Object
readonly
Returns the value of attribute allow_hash_href.
-
#alt_ignores ⇒ Object
readonly
Returns the value of attribute alt_ignores.
-
#empty_alt_ignore ⇒ Object
readonly
Returns the value of attribute empty_alt_ignore.
-
#external_urls ⇒ Object
readonly
Returns the value of attribute external_urls.
-
#href_ignores ⇒ Object
readonly
Returns the value of attribute href_ignores.
-
#hydra_opts ⇒ Object
readonly
Returns the value of attribute hydra_opts.
-
#issues ⇒ Object
readonly
Returns the value of attribute issues.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#parallel_opts ⇒ Object
readonly
Returns the value of attribute parallel_opts.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
-
#typhoeus_opts ⇒ Object
readonly
Returns the value of attribute typhoeus_opts.
-
#url_ignores ⇒ Object
readonly
Returns the value of attribute url_ignores.
-
#validation_opts ⇒ Object
readonly
Returns the value of attribute validation_opts.
Class Method Summary collapse
Instance Method Summary collapse
- #add_issue(desc, line_number = nil, status = -1)) ⇒ Object
- #add_path_for_url(url) ⇒ Object
- #add_to_external_urls(url, line) ⇒ Object
-
#initialize(src, path, html, options, typhoeus_opts, hydra_opts, parallel_opts, validation_opts) ⇒ CheckRunner
constructor
A new instance of CheckRunner.
- #run ⇒ Object
Constructor Details
#initialize(src, path, html, options, typhoeus_opts, hydra_opts, parallel_opts, validation_opts) ⇒ CheckRunner
Returns a new instance of CheckRunner.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/html/proofer/check_runner.rb', line 12 def initialize(src, path, html, , typhoeus_opts, hydra_opts, parallel_opts, validation_opts) @src = src @path = path @html = remove_ignored(html) @options = @typhoeus_opts = typhoeus_opts @hydra_opts = hydra_opts @parallel_opts = parallel_opts @validation_opts = validation_opts @issues = [] @href_ignores = @options[:href_ignore] @url_ignores = @options[:url_ignore] @alt_ignores = @options[:alt_ignore] @empty_alt_ignore = @options[:empty_alt_ignore] @allow_hash_href = @options[:allow_hash_href] @external_urls = {} end |
Instance Attribute Details
#allow_hash_href ⇒ Object (readonly)
Returns the value of attribute allow_hash_href.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def allow_hash_href @allow_hash_href end |
#alt_ignores ⇒ Object (readonly)
Returns the value of attribute alt_ignores.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def alt_ignores @alt_ignores end |
#empty_alt_ignore ⇒ Object (readonly)
Returns the value of attribute empty_alt_ignore.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def empty_alt_ignore @empty_alt_ignore end |
#external_urls ⇒ Object (readonly)
Returns the value of attribute external_urls.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def external_urls @external_urls end |
#href_ignores ⇒ Object (readonly)
Returns the value of attribute href_ignores.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def href_ignores @href_ignores end |
#hydra_opts ⇒ Object (readonly)
Returns the value of attribute hydra_opts.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def hydra_opts @hydra_opts end |
#issues ⇒ Object (readonly)
Returns the value of attribute issues.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def issues @issues end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def @options end |
#parallel_opts ⇒ Object (readonly)
Returns the value of attribute parallel_opts.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def parallel_opts @parallel_opts end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def path @path end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def src @src end |
#typhoeus_opts ⇒ Object (readonly)
Returns the value of attribute typhoeus_opts.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def typhoeus_opts @typhoeus_opts end |
#url_ignores ⇒ Object (readonly)
Returns the value of attribute url_ignores.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def url_ignores @url_ignores end |
#validation_opts ⇒ Object (readonly)
Returns the value of attribute validation_opts.
8 9 10 |
# File 'lib/html/proofer/check_runner.rb', line 8 def validation_opts @validation_opts end |
Class Method Details
.checks ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/html/proofer/check_runner.rb', line 51 def self.checks classes = [] ObjectSpace.each_object(Class) do |c| next unless c.superclass == self classes << c end classes end |
Instance Method Details
#add_issue(desc, line_number = nil, status = -1)) ⇒ Object
34 35 36 |
# File 'lib/html/proofer/check_runner.rb', line 34 def add_issue(desc, line_number = nil, status = -1) @issues << Issue.new(@path, desc, line_number, status) end |
#add_path_for_url(url) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/html/proofer/check_runner.rb', line 43 def add_path_for_url(url) if @external_urls[url] @external_urls[url] << @path else @external_urls[url] = [@path] end end |
#add_to_external_urls(url, line) ⇒ Object
38 39 40 41 |
# File 'lib/html/proofer/check_runner.rb', line 38 def add_to_external_urls(url, line) return if @external_urls[url] add_path_for_url(url) end |
#run ⇒ Object
30 31 32 |
# File 'lib/html/proofer/check_runner.rb', line 30 def run fail NotImplementedError, 'HTML::Proofer::CheckRunner subclasses must implement #run' end |