From: Intransition Date: 2010-09-25T16:54:29+09:00 Subject: Re: Ruby-based data language On Sep 22, 11:22 pm, "Sean O'Halpin" wrote: > Hi Tom, > > maybe the Doodle gem does what you're after: > > require 'doodle' > > class Contact < Doodle >   has :email, :kind => String >   has :phone, :kind => String do >     must "be of form xxx-xxx-xxxx" do |s| >       s =~ /\d{3}-\d{3}-\d{4}/ >     end >   end > end > > class Person < Doodle >   has :name, :kind => String >   has :age, :kind => Integer >   has Contact > end > > class People < Doodle >   has :people, :collect => Person > end > > people = People do >   person do >     name "Joe Foo" >     age 33 >     contact do >       email "joe....@example.com" >       phone "555-555-1234" >     end >   end > end > > p people > __END__ > # @age=33, @contact=# @phone="555-555-1234">>]> > > Regards, > Sean Close. The only thing with Doodle is that you have to pre-define the data structure. Hmm... Doodle would be something akin to a Schema language for the format I am proposing.