On Sep 2, 2005, at 4:31 PM, Oliver Cromm wrote:

> I already use YAML to handle persistance of a queue, e.g. - one big  
> data
> structure.
>
> But I don't understand how to use it for many independent values,
> something like Options.
>
> 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.

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...

James Edward Gray II