Validation

Ruby Validation Library


Project maintained by kachick Hosted on GitHub Pages — Theme by mattgraham

validation

Build Status Gem Version

Description

I think validations are not only for Web Apps :)

Features

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.