This PR also adds a number of improvements to the core Validator class:
this.value provides the value of the field being validated
this.arg provides the first argument to the validator (for the common case where the arguments are an options hash)
The most important aspect of this PR is getting more serious about the composition strategy of having validators ignore values that are not in the type they are supposed to be validating. This makes it easier to combine things like presence, numeric, and range, but also mix and match them in different ways (for example, to make a numeric validator + allowBlank).
It's a little bit of a quirky strategy, and I think I want to add a method to the base Validator to make it more obvious what's going on.
Adds an object validator.
This PR also adds a number of improvements to the core Validator class:
this.value
provides the value of the field being validatedthis.arg
provides the first argument to the validator (for the common case where the arguments are an options hash)The most important aspect of this PR is getting more serious about the composition strategy of having validators ignore values that are not in the type they are supposed to be validating. This makes it easier to combine things like presence, numeric, and range, but also mix and match them in different ways (for example, to make a numeric validator + allowBlank).
It's a little bit of a quirky strategy, and I think I want to add a method to the base Validator to make it more obvious what's going on.