title: Ruby create a class from a specification file
body: <p>I have a specification file <code>Spec.txt</code> like this</p>
  
  <pre><code> title     :Test
   attribute :fieldOne, String
   attribute :fieldTwo,  Fixnum
   constraint :fieldOne, 'fieldOne != nil'
   constraint :fieldTwo, 'fieldTwo &gt;= 0'
  </code></pre>
  
  <p>from which I need to dynamically create a class with classname <code>Test</code> and the attributes <code>fieldOne</code> and <code>fieldTwo</code> and the constraints of the attributes.
  I got so far to read in the file split up the lines and store them into arrays and then dynamically create the class with </p>
  
  <pre><code> dynamic_name = @@TITLE
      Object.const_set(dynamic_name, Class.new { 
          def init *args
          ...
          end
          })
  </code></pre>
  
  <p>But I am not sure if this is the right way to go or even how to create the attributes and the constraints now?</p>