Implement Ruby’s AppConfig file

5DollarWhiteBox has a cool lib for ruby to utilize Unix style config file, like:

serverID = web01
serverIPAddress =

I tried, it works OK. The only problem is one of my settings has a equal sign in it. This parser then screwed up.

myUrl =

So, xml config is the only option for me, and it’s more popular and cross-platform. By using ruby standard lib ‘rexml/document’, the following configuration can be easily parsed out.


require ‘rexml/document’
doc =
rss_feed_url = doc.elements[‘justing/rss_feed_url’].text


2 thoughts on “Implement Ruby’s AppConfig file

  1. Just notice this comment about ParseConfig. Wanted to drop a line and let you know this issue was fixed a while back:

    Thu Feb 28, 2008 – v0.4.2
    – Fixed bug where if the value contains a ‘=’ then the parameter
    is not properly set. [bjd]
    – Fixed bug #13680 Unable to parse config options that contain
    single quotes. [bjd]

    Please let me know if you find any other issues with it… and thanks for the mention!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s