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
27 28 29 30 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 27 def initialize(result:, context: {}) @result = result @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
20 21 22 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 20 def context @context end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
20 21 22 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 20 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
46 47 48 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 46 def call validate end |
#validate ⇒ ValidationResult
Performs validation and returns the result
This method should be overridden by subclasses
37 38 39 40 |
# File 'lib/lutaml/qea/validation/base_validator.rb', line 37 def validate raise NotImplementedError, "#{self.class} must implement #validate" end |