Assign an unknown value to an unknown variable

Hello,
I would like to read a configuration file written this way:
abcd = one
efgh = two
ijkl = three

I would like to read this file and be able to call variable abcd.
I could do it using a hashtable, but I would like to know if there is
something easier that would do the equivalent of abcd = ‘one’ and let me
use abcd directly.

Vincent

On 8/11/06, Vincent A. [email protected] wrote:

Hello,
I would like to read a configuration file written this way:
abcd = one
efgh = two
ijkl = three

I would like to read this file and be able to call variable abcd.
I could do it using a hashtable, but I would like to know if there is
something easier that would do the equivalent of abcd = ‘one’ and let me
use abcd directly.

What you want is a DSL.

See: artima - Creating DSLs with Ruby

And work from there