sxross / MotionModel

Simple Model and Validation Mixins for RubyMotion
MIT License
192 stars 67 forks source link

More robust argument checking, plus README update. #108

Closed gaelian closed 10 years ago

gaelian commented 10 years ago

The Validatable::validate class method now not only guards against the validation_type argument being an empty hash, but also makes sure that validation_type is in fact a hash as well. In either event, an exception is raised and a useful error message is displayed. Updated relevant spec.

The README now describes validation syntax correctly and a little more explicitly.

Closes #106.

gaelian commented 10 years ago

After a bit more looking, I noticed that the Validatable::validate method was already checking to see if validation_type was an empty hash, but not checking to see whether it was in fact a hash in the first place. It seemed to follow fairly logically that Validatable::validate should check whether validation_type is a Hash as well and then error out appropriately in the negative case. The included spec update covers this change.

I've also updated your README as discussed.

sxross commented 10 years ago

Great! Thanks.