Hi, I'm trying to load a file with specifications like:

title     :Person
attribute :name, String
attribute :age,  Fixnum
constraint :name, 'name != nil'
constraint :name, 'name.size > 0'
constraint :name, 'name =~ /^[A-Z]/'
constraint :age, 'age >= 0'

After which I want to create a class Person, with variables name being a
string, variable age being a fixed number and also the constraints for
them. So far I've been using this guide:
http://www.artima.com/rubycs/articles/ruby_as_dsl.html

The problem is by using this I only get the variable @title = :Person
@attribute = name, String and @constraint = age, 'age >= 0'. I know why
I'm only getting these variables, but I cant find a way to somehow read
the specification and creating the variables @name being a String, @age
being a Fixnum and these different constraints to be used later on in
for example if-conditions.

Any ideas how these specifications can be read and declared?

FYI: The formatting cant be changed and the names (name, age, Person)
can be different.
-- 
Posted via http://www.ruby-forum.com/.