Class: Uniword::Accessibility::AccessibilityChecker
- Inherits:
-
Object
- Object
- Uniword::Accessibility::AccessibilityChecker
- Defined in:
- lib/uniword/accessibility/accessibility_checker.rb
Overview
Accessibility Checker - validate document accessibility compliance
Responsibility: Orchestrate accessibility checking with profiles Single Responsibility: Accessibility validation orchestration only
External config: config/accessibility_profiles.yml
Instance Attribute Summary collapse
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
-
#check(document) ⇒ AccessibilityReport
Check document for accessibility compliance.
-
#compliant?(document) ⇒ Boolean
Quick compliance check (boolean).
-
#initialize(profile: :wcag_2_1_aa, config_file: nil) ⇒ AccessibilityChecker
constructor
Initialize a new accessibility checker.
Constructor Details
#initialize(profile: :wcag_2_1_aa, config_file: nil) ⇒ AccessibilityChecker
Initialize a new accessibility checker
27 28 29 30 31 32 33 |
# File 'lib/uniword/accessibility/accessibility_checker.rb', line 27 def initialize(profile: :wcag_2_1_aa, config_file: nil) @profile_name = profile @config_file = config_file || default_config_path @config = load_config @profile = AccessibilityProfile.load(@config, @profile_name) @rules = initialize_rules end |
Instance Attribute Details
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
20 21 22 |
# File 'lib/uniword/accessibility/accessibility_checker.rb', line 20 def profile @profile end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
20 21 22 |
# File 'lib/uniword/accessibility/accessibility_checker.rb', line 20 def rules @rules end |
Instance Method Details
#check(document) ⇒ AccessibilityReport
Check document for accessibility compliance
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/uniword/accessibility/accessibility_checker.rb', line 39 def check(document) report = AccessibilityReport.new( profile_name: @profile.name, profile_level: @profile.level, ) # Run all enabled rules @rules.each do |rule| next unless rule.enabled? violations = rule.check(document) violations.each { |v| report.add_violation(v) } end report end |
#compliant?(document) ⇒ Boolean
Quick compliance check (boolean)
60 61 62 |
# File 'lib/uniword/accessibility/accessibility_checker.rb', line 60 def compliant?(document) check(document).compliant? end |