Assign an unknown value to an unknown variable

Discussion in 'Ruby' started by Vincent Arnoux, Aug 11, 2006.

  1. 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
    Vincent Arnoux, Aug 11, 2006
    #1
    1. Advertising

  2. On 8/11/06, Vincent Arnoux <> 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

    > Vincent
    >
    >
    >
    >



    --
    "What is your function in life?" - Killer
    Arnaud Bergeron, Aug 11, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    8
    Views:
    53,500
    saravanavsk
    Jan 25, 2010
  2. Nmishra
    Replies:
    3
    Views:
    357
    Default User
    May 24, 2004
  3. Replies:
    18
    Views:
    7,037
    Karl Heinz Buchegger
    Jul 22, 2005
  4. Ranjan
    Replies:
    1
    Views:
    2,737
    Eliyahu Goldin
    Apr 10, 2007
  5. Matt
    Replies:
    2
    Views:
    824
    Anthony Judd
    Sep 25, 2004
Loading...

Share This Page