struct-validatable

Build Status Gem Version

Description

Struct will have flexible validators for each member.

Usage

Overview

require 'struct/validatable'

Person = Struct.new :name do
  validator :name, AND(String, /\w+/)
end

person = Person.new
person.name = ''        #=> error
person.name = 'Foo Bar' #=> pass
person.valid?(:name)    #=> true
person.name.clear
person.valid?(:name)    #=> false

More Examle

Requirements

Install

$ gem install struct-validatable

Link

License

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