5DollarWhiteBox has a cool lib for ruby to utilize Unix style config file, like:
serverID = web01
serverIPAddress = 192.168.1.102
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 = http://someghing.com?myId=123
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.
doc = REXML::Document.new(File.new(conf_file))
rss_feed_url = doc.elements[‘justing/rss_feed_url’].text