Class: Uniword::Validation::Rules::Base
- Inherits:
-
Object
- Object
- Uniword::Validation::Rules::Base
- Defined in:
- lib/uniword/validation/rules/base.rb
Overview
Base class for all document semantic validation rules.
Follows the Open/Closed Principle: new rules can be added by subclassing and registering, without modifying existing code.
Direct Known Subclasses
BookmarksRule, ContentTypesCoverageRule, CorePropertiesNamespaceRule, FontTableSignatureRule, FontsRule, FootnotesRule, HeadersFootersRule, ImagesRule, McIgnorableNamespaceRule, NumberingPreservationRule, NumberingRule, RelationshipIntegrityRule, RsidRule, SectionPropertiesRule, SettingsRule, SettingsValuesRule, StyleReferencesRule, TablesRule, ThemeCompletenessRule, ThemeRule
Instance Method Summary collapse
-
#applicable?(_context) ⇒ Boolean
Check if this rule applies to the given document context.
-
#category ⇒ Symbol
Category for grouping (e.g., :styles, :footnotes).
-
#check(_context) ⇒ Array<Report::ValidationIssue>
Run the validation check.
-
#code ⇒ String
Unique code for this rule (e.g., “DOC-020”).
-
#description ⇒ String?
Human-readable description of what this rule checks.
-
#severity ⇒ String
Default severity for issues from this rule.
-
#validity_rule ⇒ String?
Reference to the validity rule in docs/docx-valid/rules/.
Instance Method Details
#applicable?(_context) ⇒ Boolean
Check if this rule applies to the given document context.
71 72 73 |
# File 'lib/uniword/validation/rules/base.rb', line 71 def applicable?(_context) true end |
#category ⇒ Symbol
Category for grouping (e.g., :styles, :footnotes).
56 57 58 |
# File 'lib/uniword/validation/rules/base.rb', line 56 def category :general end |
#check(_context) ⇒ Array<Report::ValidationIssue>
Run the validation check.
79 80 81 |
# File 'lib/uniword/validation/rules/base.rb', line 79 def check(_context) [] end |
#code ⇒ String
Unique code for this rule (e.g., “DOC-020”).
35 36 37 |
# File 'lib/uniword/validation/rules/base.rb', line 35 def code nil end |
#description ⇒ String?
Human-readable description of what this rule checks.
49 50 51 |
# File 'lib/uniword/validation/rules/base.rb', line 49 def description nil end |
#severity ⇒ String
Default severity for issues from this rule.
63 64 65 |
# File 'lib/uniword/validation/rules/base.rb', line 63 def severity "error" end |
#validity_rule ⇒ String?
Reference to the validity rule in docs/docx-valid/rules/.
42 43 44 |
# File 'lib/uniword/validation/rules/base.rb', line 42 def validity_rule nil end |