Sha256: 3a36914446e7602a2e4d08ed61f00d5c35c0a5004338a4de115e5751214bfcef

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

# 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

Standalone:

```ruby
class User
  include Yema::Validations
  attr_accessor :age
end

User.rules.add(Yema::Rule::StrongType, 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yema-0.0.1 README.md