deseretbook/classy_hash — pull request #3 by ntl (2014-08-16 16:40:57+00:00)
Title: Validate full

Implement ClassyHash.validate_full

Fixes #1

* SchemaValidationError exceptions can now be continued; this allows
someone rescuing such an Error to proceed through the validation,
collecting every error on the way. The benefit of this approach is
that the performance of .validate and .validate_strict is not
significantly compromised, since they behave almost exactly as
before.

Although using exceptions for flow control is not generally
desirable, in this case, the exception is fully hidden from the
consuming code.

* ClassyHash.validate_full can take a block that gets called for every
instance of a validation error. When you pass a block, the
SchemaValidationError is actually suppressed, since presumably the
consuming code intends to actually do something with the errors.

Passing a block is how, for example, rails style validations could be
implemented on top of classy_hash.

* I ran the benchmarks, there was no material difference in performance
between the classy_hash and no_op before and after the change.