[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Assign an unknown value to an unknown variable

Vincent Arnoux

8/11/2006 4:40:00 PM

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



1 Answer

Arnaud Bergeron

8/11/2006 6:12:00 PM

0

On 8/11/06, Vincent Arnoux <vincent.arnoux@rfo.atmel.com> 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_a...

And work from there

> Vincent
>
>
>
>


--
"What is your function in life?" - Killer