Forum: Ruby Parse conf file for CLI tool

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
2b7d45052ab60da9c6c960defb2a7793?d=identicon&s=25 Moritz Reiter (crytyca)
on 2007-01-26 17:32

I'm pretty new to ruby and want to program some some linux shell tools
in ruby as exercise. For these tools I want to be able to specify
options as parameters on the command line or in a config file.
I already discovered OptionParser to parse the command line options.

Can someone give me suggestions which classes to look at to simplify the
task of parsing a configuration file for options?

Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 unknown (Guest)
on 2007-01-26 17:46
(Received via mailing list)
On Sat, 27 Jan 2007, Moritz Reiter wrote:

> Regards,
> mo

   harp:~ > cat a.rb
   #! /usr/bin/env ruby
   require 'yaml'

   config = 'config.yml'
   options = YAML.load(
   y options

   harp:~ > cat config.yml
   key : value
   a : b

   harp:~ > ruby a.rb
   a: b
   key: value

2b7d45052ab60da9c6c960defb2a7793?d=identicon&s=25 Moritz Reiter (crytyca)
on 2007-01-28 16:43
That's exactly what I was looking for. Thanks!
This topic is locked and can not be replied to.