Class: Uniword::Validation::LinkChecker Abstract
- Inherits:
-
Object
- Object
- Uniword::Validation::LinkChecker
- Defined in:
- lib/uniword/validation/link_checker.rb
Overview
Subclass and override #can_check? and #check
Base class for link checkers.
Responsibility: Define interface for link validation checkers. Single Responsibility: Provide checker contract only.
All link checkers inherit from this class and implement:
-
can_check?(link): Can this checker validate this link?
-
check(link, document): Perform validation
This follows the Strategy pattern - different checkers for different link types, all with the same interface.
Direct Known Subclasses
Checkers::ExternalLinkChecker, Checkers::FileReferenceChecker, Checkers::FootnoteReferenceChecker, Checkers::InternalLinkChecker
Instance Attribute Summary collapse
-
#config ⇒ Hash
readonly
Configuration for this checker.
Instance Method Summary collapse
-
#can_check?(link) ⇒ Boolean
abstract
Check if this checker can validate the given link.
-
#check(link, document = nil) ⇒ ValidationResult
abstract
Validate the given link.
-
#initialize(config: {}) ⇒ LinkChecker
constructor
Initialize a new LinkChecker.
Constructor Details
#initialize(config: {}) ⇒ LinkChecker
Initialize a new LinkChecker.
42 43 44 |
# File 'lib/uniword/validation/link_checker.rb', line 42 def initialize(config: {}) @config = config || {} end |
Instance Attribute Details
#config ⇒ Hash (readonly)
Returns Configuration for this checker.
34 35 36 |
# File 'lib/uniword/validation/link_checker.rb', line 34 def config @config end |
Instance Method Details
#can_check?(link) ⇒ Boolean
Subclasses must implement this method
Check if this checker can validate the given link.
55 56 57 58 |
# File 'lib/uniword/validation/link_checker.rb', line 55 def can_check?(link) raise NotImplementedError, "#{self.class}#can_check? must be implemented" end |
#check(link, document = nil) ⇒ ValidationResult
Subclasses must implement this method
Validate the given link.
70 71 72 73 |
# File 'lib/uniword/validation/link_checker.rb', line 70 def check(link, document = nil) raise NotImplementedError, "#{self.class}#check must be implemented" end |