Class: Castkit::Validators::BaseValidator Abstract
- Inherits:
-
Object
- Object
- Castkit::Validators::BaseValidator
- Defined in:
- lib/castkit/validators/base_validator.rb
Overview
This class is abstract.
Abstract base class for all attribute validators.
Validators ensure that a value conforms to specific rules (e.g., type, format, range). Subclasses must implement the instance method ‘#call`.
Direct Known Subclasses
Class Method Summary collapse
-
.call(value, options:, context:) ⇒ void
Invokes the validator with the given arguments.
Instance Method Summary collapse
-
#call(value, options:, context:) ⇒ void
abstract
Validates the attribute value.
Class Method Details
.call(value, options:, context:) ⇒ void
This method returns an undefined value.
Invokes the validator with the given arguments.
20 21 22 |
# File 'lib/castkit/validators/base_validator.rb', line 20 def call(value, options:, context:) new.call(value, options: , context: context) end |
Instance Method Details
#call(value, options:, context:) ⇒ void
This method is abstract.
Override in subclasses.
This method returns an undefined value.
Validates the attribute value.
34 35 36 |
# File 'lib/castkit/validators/base_validator.rb', line 34 def call(value, options:, context:) raise NotImplementedError, "#{self.class.name} must implement `#call`" end |