Class: Abqari::Audit::Rule
- Inherits:
-
Object
- Object
- Abqari::Audit::Rule
- Defined in:
- lib/abqari/audit/rule.rb
Overview
Base class for audit rules. Each rule lives in its own file under
lib/abqari/audit/<category>.rb, inherits from this, and implements
#run. Shared helpers (html_files, page_url, add) live here
so individual rules stay focused on their domain logic.
Rules are stateless across runs — instantiated by Audit#run with
the current site and findings list, then discarded. Caching that
makes sense for the duration of a single audit (e.g. memoised
html_files) lives on the instance.
Direct Known Subclasses
A11y, Content, Dependencies, Links, Performance, Privacy, SEO
Instance Method Summary collapse
-
#initialize(site, findings) ⇒ Rule
constructor
A new instance of Rule.
-
#run ⇒ Object
Subclasses override.
Constructor Details
#initialize(site, findings) ⇒ Rule
Returns a new instance of Rule.
15 16 17 18 |
# File 'lib/abqari/audit/rule.rb', line 15 def initialize(site, findings) @site = site @findings = findings end |
Instance Method Details
#run ⇒ Object
Subclasses override. The default raises so a half-finished rule surfaces immediately in tests instead of silently no-opping.
22 23 24 |
# File 'lib/abqari/audit/rule.rb', line 22 def run raise NotImplementedError, "#{self.class.name} must implement #run" end |