You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are now several validator classes that share validations, and these validations are done in a similar way.
Remove this repetition by moving all validator methods to its own file, and then replace the validator classes with a single composite class that picks the validations it needs.
Then the Validation class doesn't need to be exposed and can be a private class of the composite.
It may be tempting to use Validators as an included module, but that introduces an inheritance pattern that is not needed here, as different validators will require a different list of validator methods.
The text was updated successfully, but these errors were encountered:
See our contributing guides.
There are now several validator classes that share validations, and these validations are done in a similar way.
Remove this repetition by moving all validator methods to its own file, and then replace the validator classes with a single composite class that picks the validations it needs.
Then the
Validation
class doesn't need to be exposed and can be a private class of the composite.For example:
and the composite class:
Then, whenever a validator class is used, it can be replaced with this composite:
It may be tempting to use
Validators
as an included module, but that introduces an inheritance pattern that is not needed here, as different validators will require a different list of validator methods.The text was updated successfully, but these errors were encountered: