Class: Ukiryu::Validation::Constraint Abstract
- Inherits:
-
Object
- Object
- Ukiryu::Validation::Constraint
- Defined in:
- lib/ukiryu/validation/constraints.rb
Overview
This class is abstract.
Abstract base class for all constraints
Constraints define validation rules that can be applied to values. Each constraint type encapsulates a specific validation logic.
Direct Known Subclasses
BooleanFlagConstraint, CardinalityConstraint, DependencyConstraint, EnumConstraint, RangeConstraint, RequiredConstraint, TypeConstraint
Instance Method Summary collapse
-
#applies_to?(_context) ⇒ Boolean
Check if this constraint applies to the given context.
-
#validate(value, context = {}) ⇒ void
Validate a value against this constraint.
Instance Method Details
#applies_to?(_context) ⇒ Boolean
Check if this constraint applies to the given context
26 27 28 |
# File 'lib/ukiryu/validation/constraints.rb', line 26 def applies_to?(_context) true end |
#validate(value, context = {}) ⇒ void
This method returns an undefined value.
Validate a value against this constraint
18 19 20 |
# File 'lib/ukiryu/validation/constraints.rb', line 18 def validate(value, context = {}) raise NotImplementedError, 'Subclasses must implement validate' end |