README.md in ohm-validations-0.0.1 vs README.md in ohm-validations-1.0.0

- old
+ new

@@ -1,14 +1,35 @@ -ohm-validations +ohm-validations [![Build Status](https://travis-ci.org/frodsan/ohm-validations.svg)](https://travis-ci.org/frodsan/ohm-validations) =============== Validations for Ohm::Model. +Installation +------------ + +Add this line to your application's Gemfile: + +```ruby +gem "ohm-validations" +``` + +And then execute: + +``` +$ bundle +``` + +Or install it yourself as: + +``` +$ gem install ohm-validations +``` + Usage ----- -``` +```ruby class User < Ohm::Model include Ohm::Validations attribute :name attribute :email @@ -20,35 +41,62 @@ def validate assert_present(:name) assert_email(:email) end - def before_validation + def before_validate @before = true end - def after_validation + def after_validate @after = true end end -user = User.new({}) +User.create +# => nil + +user = User.new user.valid? # => false user.update_attributes(name: "jhon", email: "jhon@doe.com") user.valid? # => true +user.save # => user user.before # => true user.after # => true ``` Check [scrivener][scrivener] project for more information about the available validations. -Installation +Contributing ------------ +Fork the project with: + ``` -$ gem install ohm-validations +$ git clone git@github.com:frodsan/ohm-validations.git ``` +To install dependencies, use: + +``` +$ bundle install +``` + +To run the test suite, do: + +``` +$ rake test +``` + +For bug reports and pull requests use [GitHub][issues]. + +License +------- + +This gem is released under the [MIT License][mit]. + +[mit]: http://www.opensource.org/licenses/MIT +[issues]: https://github.com/frodsan/ohm-validations/issues [scrivener]: https://github.com/soveran/scrivener