Skip to content
Struct will have validators for each member
Ruby
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.
example
lib/struct
test
.gitignore
.travis.yml
.yardopts
Gemfile
MIT-LICENSE
README.md
Rakefile
struct-validatable.gemspec

README.md

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.

You can’t perform that action at this time.