abstract struct Athena::Validator::ConstraintValidator
- Athena::Validator::ConstraintValidator
- Struct
- Value
- Object
Overview
Basic implementation of AVD::ConstraintValidatorInterface
.
Included Modules
Direct Known Subclasses
- Athena::Validator::Constraints::All::Validator
- Athena::Validator::Constraints::AtLeastOneOf::Validator
- Athena::Validator::Constraints::Blank::Validator
- Athena::Validator::Constraints::Callback::Validator
- Athena::Validator::Constraints::Choice::Validator
- Athena::Validator::Constraints::ComparisonValidator
- Athena::Validator::Constraints::Compound::Validator
- Athena::Validator::Constraints::Email::Validator
- Athena::Validator::Constraints::IP::Validator
- Athena::Validator::Constraints::ISBN::Validator
- Athena::Validator::Constraints::IsFalse::Validator
- Athena::Validator::Constraints::ISIN::Validator
- Athena::Validator::Constraints::IsNil::Validator
- Athena::Validator::Constraints::ISSN::Validator
- Athena::Validator::Constraints::IsTrue::Validator
- Athena::Validator::Constraints::Luhn::Validator
- Athena::Validator::Constraints::NotBlank::Validator
- Athena::Validator::Constraints::NotNil::Validator
- Athena::Validator::Constraints::Range::Validator
- Athena::Validator::Constraints::Regex::Validator
- Athena::Validator::Constraints::Sequentially::Validator
- Athena::Validator::Constraints::Size::Validator
- Athena::Validator::Constraints::Unique::Validator
- Athena::Validator::Constraints::URL::Validator
- Athena::Validator::Constraints::Valid::Validator
- Athena::Validator::ServiceConstraintValidator
- Athena::Validator::Spec::FailingConstraint::Validator
Defined in:
constraint_validator.crConstructors
Instance Method Summary
-
#context : AVD::ExecutionContextInterface
Returns the a reference to the
AVD::ExecutionContextInterface
to which violations withinself
should be added. - #initialize
-
#raise_invalid_type(value : _, supported_types : String) : NoReturn
Can be used to raise an
AVD::Exceptions::UnexpectedValueError
in caseself
is only able to validate values of the supported_types. -
#validate(value : _, constraint : AVD::Constraint) : Nil
Validate the provided value against the provided constraint.
Instance methods inherited from module Athena::Validator::ConstraintValidatorInterface
context : AVD::ExecutionContextInterface
context,
validate(value : _, constraint : AVD::Constraint) : Nil
validate
Constructor Detail
Instance Method Detail
Returns the a reference to the AVD::ExecutionContextInterface
to which violations within self
should be added.
See the type for more information.
Can be used to raise an AVD::Exceptions::UnexpectedValueError
in case self
is only able to validate values of the supported_types.
# Define a validate method to catch values of other types.
# Overloads above would handle the valid types.
def validate(value : _, constraint : AVD::Constraints::MyConstraint) : Nil
self.raise_invalid_type value, "Int | Float"
end
This would result in a violation with the message This value should be a valid: Int | Float
being added to the current #context
.
Validate the provided value against the provided constraint.
Violations should be added to the current #context
.