From: Phil Meier Date: 2007-10-02T15:55:03+09:00 Subject: Re: Config files I like using Ruby directly for doing stuff like this (if the "configuration file" is under my control). Example: module MyConfig user = 'username' pass = 'password' log_file = '/var/log/mylog' end => Store in file 'MyConfig.rb' test.rb: require 'MyConfig' p MyConfig::User p MyConfig::Pass p MyConfig::Log_file BR Phil Meier BJ Dierkes schrieb: > I prefer using standard *nix style configuration files in the form of > 'param = value'. I wrote a class to read this type of configuration > file called ParseConfig. > > http://rubyforge.org/projects/parseconfig/ > > > It is available via rubygems/rubyforge: > > gem install parseconfig > > > Usage is really simple. Say you have a config file that looks like: > > --- > user = 'username' > pass = 'password' > log_file = '/var/log/mylog' > --- > > A quick example to use this config would be: > --- > require('rubygems') > require('parseconfig') > > config = ParseConfig.new('/path/to/config/file') > user = config.get_value('user') > pass = config.get_value('pass') > log_file = config.get_value('log_file') > --- > > > If you all have any suggestions, etc... you can submit them via the > RubyForge Tracker. > > > On Oct 1, 2007, at 6:21 PM, Lee Jarvis wrote: > >> I am writing an application that will read and grab values from a >> configuration file. I am wondering what peoples opinions are on what to >> use. YAML? XML? Does anyone have any preference? Are any better then the >> others or is it just down to user preference? >> >> Thanks >> -- >> Posted via http://www.ruby-forum.com/. >> > >