Skip to content
Validations with Ruby objects
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
lib
test
.gitignore
.travis.yml
.yardopts
Gemfile
MIT-LICENSE
README.md
Rakefile
validation.gemspec

README.md

validation

Build Status Gem Version

Description

Validations with Ruby objects.

Features

  • Pure Ruby :)

Usage

How to build flexible conditions

An optional extension for accessor with validation.

require 'validation'

class Person
  include Validation

  attr_validator :name, String
  attr_validator :id, OR(nil, AND(Integer, 1..100))
end

person = Person.new
person.name = :Ken  #=> Error (Symbol is not String)
person.id   = 200   #=> Error (200 is not covered by 1..100)
person.name = 'Ken' #=> Pass
person.id   = 1     #=> Pass

More Examples

Requirements

Install

gem install validation

Link

License

The MIT X11 License
Copyright (c) 2011-2012 Kenichi Kamiya
See MIT-LICENSE for further details.

You can’t perform that action at this time.