* James Edward Gray II wrote: > On Sep 2, 2005, at 4:31 PM, Oliver Cromm wrote: > >> So I have a script with these settings (currently as Constants in the >> script) >> >> SERVER = news.example.org >> PORT = 100 >> USER = myname >> PASS = topsecret >> >> How do I put this in a YAML file and load it into my Ruby script? All >> ways I can think of are clumsy. Or shouldn't I? > > The first thought that pops into my head is to store these options in > a Hash, then YAML that back and forth. Well, by 'clumsy' I meant exactly something like | login(Options['server'], Options['port'], Options['user'], Options['pass']) and so on throughout the script. > If you're really attached to the constants though, write a method > that finds them via reflection, builds the Hash, and YAML stores it. > Then write another method to reverse the process. Shout if you get > stuck on any of that and I will help... I don't know what reflection means in this context, but am I guessing right that we are talking about something (maybe something more elegant) that has the same *effect* as: def getOptions Options = YAML.load_file(OPTFILE) SERVER = Options['server'] PORT = Options['port'] ... end -- Oliver C. 45n31, 73w34 Temperatur: 24 (Humidex: 27) (6 September 2005 2:00 PM EDT)