Class: Castkit::Validator Abstract
- Inherits:
-
Object
- Object
- Castkit::Validator
- Defined in:
- lib/castkit/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`.
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.
19 20 21 |
# File 'lib/castkit/validator.rb', line 19 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.
33 34 35 |
# File 'lib/castkit/validator.rb', line 33 def call(value, options:, context:) raise NotImplementedError, "#{self.class.name} must implement `#call`" end |