From: Dick Davies Date: 2008-01-11T05:52:37+09:00 Subject: Re: using ruby for config files I used to love YAML but the whitespace / indent issue has bitten me too many times. I needed a config file today, and eventually went for a lib/config.rb like: CONFIG = { :servera => { :hostname => 'a.com', :remote_user => 'usera' }, :serverb => { :hostname => 'b.org', :remote_user => 'userb' } } I just load it in with 'require config'. I know it's a bit cryptic to non-rubyists (compared to e.g. yaml) but it has the HUGE advantage of being easy to validate (ruby -wc lib/config.rb). Be interested to know how others do it - an include/mixin maybe? On Jan 9, 2008 9:00 AM, Marc Heiler wrote: > Hmm the config style looks nice, but the code looks a bit complex? > > I use yaml right now even though it has a few disadvantages (for me in > this regard) because of indent (where a user may get parse errors). > And from this yaml info I generate or build system info, on top of it. > > I think what would be cool, would be a minimal "config" interpreter with > only > a very few (but still quite) readable lines of ruby code. (Anyway, > that's just my opinion) -- Rasputnik :: Jack of All Trades - Master of Nuns http://number9.hellooperator.net/