Class: Lutaml::Qea::Validation::BaseValidator
- Inherits:
-
Object
- Object
- Lutaml::Qea::Validation::BaseValidator
- Defined in:
- lib/lutaml/qea/validation/base_validator.rb
Overview
Base class for all validators providing common validation infrastructure and helper methods
Direct Known Subclasses
AssociationValidator, AttributeValidator, CircularReferenceValidator, ClassValidator, DiagramValidator, OperationValidator, OrphanValidator, PackageValidator, ReferentialIntegrityValidator, Uml::Validation::DocumentStructureValidator
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#call ⇒ void
Runs validation Result is populated in the shared @result object.
-
#initialize(result:, context: {}) ⇒ BaseValidator
constructor
Creates a new validator.
-
#validate ⇒ ValidationResult
Performs validation and returns the result.
Constructor Details
#initialize(result:, context: {}) ⇒ BaseValidator
Creates a new validator
26 27 28 29 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 26 def initialize(result:, context: {}) @result = result @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
19 20 21 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 19 def context @context end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
19 20 21 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 19 def result @result end |
Instance Method Details
#call ⇒ void
This method returns an undefined value.
Runs validation Result is populated in the shared @result object
45 46 47 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 45 def call validate end |
#validate ⇒ ValidationResult
Performs validation and returns the result
This method should be overridden by subclasses
36 37 38 39 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 36 def validate raise NotImplementedError, "#{self.class} must implement #validate" end |