"Anders Johannsen" <anders / ignition.dk> writes:

> Is there a preferred way of parsing configuration files in Ruby? I
> suppose yacc/lex is ruled out?

A cheap way that works in some circumstances is to write the
configuration in Ruby, and then just require the file in:

  logfile {
    path            "/var/log/mylog"
    days_to_expire  10
    level           :error
  }

  color {
    if $black_and_white
       text        :black
       background  :white
    else
       text        #030306
       background  #e0e0e0
    end
  }

and so on.

This only works if you trust your user, or if you can load the file in
using a high $SAFE value, but it's pretty cheap to write :)



Dave