Class: Ra11y::HtmlFile
- Inherits:
-
Object
- Object
- Ra11y::HtmlFile
- Defined in:
- lib/ra11y/html_file.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(path) ⇒ HtmlFile
constructor
A new instance of HtmlFile.
- #inspect ⇒ Object
- #notices ⇒ Object
- #perfect? ⇒ Boolean
- #results ⇒ Object
- #warnings ⇒ Object
Constructor Details
#initialize(path) ⇒ HtmlFile
Returns a new instance of HtmlFile.
6 7 8 |
# File 'lib/ra11y/html_file.rb', line 6 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/ra11y/html_file.rb', line 4 def path @path end |
Instance Method Details
#errors ⇒ Object
18 19 20 |
# File 'lib/ra11y/html_file.rb', line 18 def errors @errors ||= results_by_type "error" end |
#inspect ⇒ Object
30 31 32 |
# File 'lib/ra11y/html_file.rb', line 30 def inspect "#<Ra11y::HtmlFile path=\"#{path.gsub(Dir.pwd, "")}\" errors=#{errors.count} warnings=#{warnings.count} notices=#{notices.count}>" end |
#notices ⇒ Object
26 27 28 |
# File 'lib/ra11y/html_file.rb', line 26 def notices @notices ||= results_by_type "notice" end |
#perfect? ⇒ Boolean
10 11 12 |
# File 'lib/ra11y/html_file.rb', line 10 def perfect? errors.empty? && warnings.empty? end |
#results ⇒ Object
14 15 16 |
# File 'lib/ra11y/html_file.rb', line 14 def results @results ||= test["results"].map { |hash| Result.new(hash) } end |
#warnings ⇒ Object
22 23 24 |
# File 'lib/ra11y/html_file.rb', line 22 def warnings @warnings ||= results_by_type "warning" end |