I am making a framework where objects should be created a according to a predefined XML file. For example, if in the xml file the following occurs:
<type name="man">
<property name="name" type="string">
<property name="height" type="int">
<property name="age" type="int">
<property name="profession" type="string" value="unemployed">
</type>
In Ruby, this should allow you to create an object as following:
man = Man.new('John', 188, 30)
Note: For fields where 'value' is defined in the xml, no value should be accepted in the initialize method, but should rather be set by the class itself as a default value.
Any recommended implementations for this? I am current watching Dave Thomas' screencasts about meta programming, so this looks very suitable, but any suggestions would be appreciated!