Class: HTML::Proofer::Checks::Check
- Inherits:
-
Object
- Object
- HTML::Proofer::Checks::Check
- Defined in:
- lib/html/proofer/check.rb
Instance Attribute Summary collapse
-
#additional_alt_ignores ⇒ Object
readonly
Returns the value of attribute additional_alt_ignores.
-
#additional_href_ignores ⇒ Object
readonly
Returns the value of attribute additional_href_ignores.
-
#external_urls ⇒ Object
readonly
Returns the value of attribute external_urls.
-
#issues ⇒ Object
readonly
Returns the value of attribute issues.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
Class Method Summary collapse
Instance Method Summary collapse
- #add_issue(desc, status = nil) ⇒ Object
- #add_to_external_urls(href) ⇒ Object
-
#initialize(src, path, html, opts = {}) ⇒ Check
constructor
A new instance of Check.
- #output_filenames ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(src, path, html, opts = {}) ⇒ Check
Returns a new instance of Check.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/html/proofer/check.rb', line 14 def initialize(src, path, html, opts={}) @src = src @path = path @html = remove_ignored(html) @options = opts @issues = [] @additional_href_ignores = @options[:href_ignore] @additional_alt_ignores = @options[:alt_ignore] @external_urls = {} end |
Instance Attribute Details
#additional_alt_ignores ⇒ Object (readonly)
Returns the value of attribute additional_alt_ignores.
12 13 14 |
# File 'lib/html/proofer/check.rb', line 12 def additional_alt_ignores @additional_alt_ignores end |
#additional_href_ignores ⇒ Object (readonly)
Returns the value of attribute additional_href_ignores.
12 13 14 |
# File 'lib/html/proofer/check.rb', line 12 def additional_href_ignores @additional_href_ignores end |
#external_urls ⇒ Object (readonly)
Returns the value of attribute external_urls.
12 13 14 |
# File 'lib/html/proofer/check.rb', line 12 def external_urls @external_urls end |
#issues ⇒ Object (readonly)
Returns the value of attribute issues.
12 13 14 |
# File 'lib/html/proofer/check.rb', line 12 def issues @issues end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/html/proofer/check.rb', line 12 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
12 13 14 |
# File 'lib/html/proofer/check.rb', line 12 def path @path end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
12 13 14 |
# File 'lib/html/proofer/check.rb', line 12 def src @src end |
Class Method Details
.subclasses ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/html/proofer/check.rb', line 45 def self.subclasses classes = [] ObjectSpace.each_object(Class) do |c| next unless c.superclass == self classes << c end classes end |
Instance Method Details
#add_issue(desc, status = nil) ⇒ Object
29 30 31 |
# File 'lib/html/proofer/check.rb', line 29 def add_issue(desc, status = nil) @issues << Issue.new(@path, desc, status) end |
#add_to_external_urls(href) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/html/proofer/check.rb', line 37 def add_to_external_urls(href) if @external_urls[href] @external_urls[href] << @path else @external_urls[href] = [@path] end end |
#output_filenames ⇒ Object
33 34 35 |
# File 'lib/html/proofer/check.rb', line 33 def output_filenames Dir[@site.config[:output_dir] + '/**/*'].select{ |f| File.file?(f) } end |
#run ⇒ Object
25 26 27 |
# File 'lib/html/proofer/check.rb', line 25 def run raise NotImplementedError.new("HTML::Proofer::Check subclasses must implement #run") end |