define schemas as a hash, and validate hashes!
require 'hashidator'
schema = {:name => String, :age => Integer}
valid = {:name => "Harry", :age => 20}
invalid = {:name => 1234, :age => "twenty"}
h = Hashidator.new(schema)
h.validate(valid) #=> true
h.validate(invalid) #=> false
see examples/basic.rb for full coverage. it knows classes, ranges, booleans, proc and duck typing. yay!
to release this gem:
* edit lib/hashidator/version.rb
* edit CHANGES
* git commit -am "Release VERSION"
* rake release
© 2009 harry vangberg <[email protected]>,
peter suschlik <[email protected]>
distributed under the mit license. google it.