Class: Accessibility::Audit
- Inherits:
-
Object
- Object
- Accessibility::Audit
- Extended by:
- Forwardable
- Defined in:
- lib/accessibility/audit.rb
Overview
An Accessibility::Audit is in charge of parsing the rules found on the raw response from the access-lint-server, available on the Checker, and filtering them by different criteria.
Instance Method Summary collapse
-
#all ⇒ Object
Returns all the rules.
-
#errors ⇒ Object
Returns the rules that failed with a severity of “Severe”.
-
#failed ⇒ Object
Returns the rules that failed on the checked document.
-
#initialize(checker) ⇒ Audit
constructor
A new instance of Audit.
-
#not_applicable ⇒ Object
Returns the rules that were not applicable to the checked document.
-
#passed ⇒ Object
Returns the rules that passed on the checked document.
- #rules ⇒ Object
-
#warnings ⇒ Object
Returns the rules that failed with a severity of “Warning”.
Constructor Details
#initialize(checker) ⇒ Audit
Returns a new instance of Audit.
9 10 11 |
# File 'lib/accessibility/audit.rb', line 9 def initialize(checker) @checker = checker end |
Instance Method Details
#all ⇒ Object
Returns all the rules
21 22 23 |
# File 'lib/accessibility/audit.rb', line 21 def all @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) } end |
#errors ⇒ Object
Returns the rules that failed with a severity of “Severe”
41 42 43 |
# File 'lib/accessibility/audit.rb', line 41 def errors @errors ||= failed.select { |rule| rule.severity == "Severe" } end |
#failed ⇒ Object
Returns the rules that failed on the checked document
36 37 38 |
# File 'lib/accessibility/audit.rb', line 36 def failed @failed ||= all.select { |rule| rule.status == "FAIL" } end |
#not_applicable ⇒ Object
Returns the rules that were not applicable to the checked document
26 27 28 |
# File 'lib/accessibility/audit.rb', line 26 def not_applicable @not_applicable ||= all.select { |rule| rule.status == "NA" } end |
#passed ⇒ Object
Returns the rules that passed on the checked document
31 32 33 |
# File 'lib/accessibility/audit.rb', line 31 def passed @passed ||= all.select { |rule| rule.status == "PASS" } end |
#rules ⇒ Object
16 17 18 |
# File 'lib/accessibility/audit.rb', line 16 def rules self end |
#warnings ⇒ Object
Returns the rules that failed with a severity of “Warning”
46 47 48 |
# File 'lib/accessibility/audit.rb', line 46 def warnings @warnings ||= failed.select { |rule| rule.severity == "Warning" } end |