Class: Castkit::Validators::Base Abstract
- Inherits:
-
Object
- Object
- Castkit::Validators::Base
- Defined in:
- lib/castkit/validators/base.rb
Overview
This class is abstract.
Subclasses must implement ‘#call`.
Abstract base class for all attribute validators.
Validators are responsible for enforcing value constraints (e.g., type checks, format rules, numerical bounds). All validators must inherit from this base class and implement the ‘#call` instance method.
Supports both instance-level and class-level invocation via ‘.call`.
Direct Known Subclasses
Class Method Summary collapse
-
.call(value, options:, context:) ⇒ void
Entry point for validating a value using the validator class.
Instance Method Summary collapse
-
#call(value, options:, context:) ⇒ void
abstract
Validates the value.
Class Method Details
.call(value, options:, context:) ⇒ void
This method returns an undefined value.
Entry point for validating a value using the validator class.
Instantiates the validator and invokes ‘#call` with the provided arguments.
25 26 27 |
# File 'lib/castkit/validators/base.rb', line 25 def call(value, options:, context:) new.call(value, options: , context: context) end |
Instance Method Details
#call(value, options:, context:) ⇒ void
This method is abstract.
This method returns an undefined value.
Validates the value.
38 39 40 |
# File 'lib/castkit/validators/base.rb', line 38 def call(value, options:, context:) raise NotImplementedError, "#{self.class.name} must implement `#call`" end |