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: http://www.artima.com/rubycs/articles/ruby_as_dsl.html

And work from there

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs