Schema_hash is a project mainly written in Ruby, based on the MIT license.
Give a schema to a Ruby Hash
Is your hash in shape? Validates a hash against a (basic) schema.
This was built to support validation of config.yml files with nested keys.
> require 'schema_hash'
> h = { :timeout => 10, :uri => "data.gov" }
> h.schema = { :timeout => true }
> h.valid?
=> false
h.schema = { :timeout => true, :uri => true, :key => true }
h.valid?
=> false
h.schema = { :timeout => true, :uri => true }
h.valid?
=> true
Copyright (c) 2009 David James. See LICENSE for details.