# Yema [![Build Status](https://travis-ci.org/handiwiguna/yema.png?branch=master)](https://travis-ci.org/handiwiguna/yema) [![Code Climate](https://codeclimate.com/github/handiwiguna/yema.png)](https://codeclimate.com/github/handiwiguna/yema) ## Installation Add this line to your application's Gemfile: gem 'yema' And then execute: $ bundle Or install it yourself as: $ gem install yema ## Usage Inline: ```ruby validator = Yema::Validator.new(params, Yema::Rule::Required.new(:title)) validator.valid? ``` Class: ```ruby class User include Yema::Validations attr_accessor :age end User.rules.add(Yema::Rule::StrongType.new(:age), Integer) user = User.new user.age = 3 user.valid? # => true user.age = '3' user.valid? # => true user.age = 'abc' user.valid? # => false ``` Virtus Integration: ```ruby class UserParam include Yema::Virtus::Validations attribute :age, Integer, required: true end user = UserParam.new(age: 2) user.valid? # => true user = UserParam.new(age: '2') user.valid? # => true user = UserParam.new(age: 'abc') user.valid? # => false user = UserParam.new user.valid? # => false ``` ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request