From: Jim Crossley Date: 2006-10-06T20:40:14+09:00 Subject: Re: Using configuration files (replacing shellscripts) Hi... Karl Voit writes: > I want to use configuration files in order to save values, > directories, and files. I did some googeling to find out that the > ruby community often suggests ruby-files (hashes) to save > configurations. These rb-files are read in by interpreting. (btw, > anyone suggests a cool part of code for this with errorhandling and > so on?) 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... require 'yaml' dbconfig = YAML::load(IO.read('config.yml')) assert_equal('karl', dbconfig[:username]) Jim