From: Trans Date: 2006-10-06T22:40:18+09:00 Subject: Re: Using configuration files (replacing shellscripts) Karl Voit wrote: > * Jim Crossley wrote: > > Hi... > > Hi! > > > If I understand what you're asking for, you may want to have a look at > > YAML. Your config file can look like this: > > > > #### > > adapter: mysql > > database: demodb > > username: karl > > password: pa$$w0rd > > socket: /var/lib/mysql/mysql.sock > > #### > > > > Turning that file into a ruby hash is a one-liner... > > Thanks for the hint. > > Is is possible to reduce the redundancy of > > ,---- > | basedir: /this/directory > | logdir: /this/directory/log > `---- > > to something like that? > > ,---- > | basedir: /this/directory > | logdir: $basedir/log > `---- > > I have to use this in the configs quite often. I've been asking for interpolation in YAML for a while now. Either the feature or I am being ignored :-( FYI, though. It's not to hard to create a two-pass filter to add this functionity if you really need it. T.