Class: Accessibility::Audit

Inherits:
Object
  • Object
show all
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

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

#allObject

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

#errorsObject

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

#failedObject

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_applicableObject

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

#passedObject

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

#rulesObject



16
17
18
# File 'lib/accessibility/audit.rb', line 16

def rules
  self
end

#warningsObject

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