by BJ Dierkes http://www.5dollarwhitebox.org changes by Jesse Newland http://www.railsmachine.com
rb-parseconfig is a Ruby class written to parse simple configuration files in the format of 'param = value'. The key benefit is that your ruby scripts can use the same configuration files of most unix/linux applications.
Parsing of simple configuration files (not Ruby specific). Allows ruby applications as well as Bash Init scripts to use the same config.
Problem: Currently single quotes are stripped… therefore, values with a single quote are not possible.
require('rubygems') require('parseconfig') config = ParseConfig.new('/path/to/config/file') puts config['log_file'] puts config['pid_file'] ...
* Ruby (Developed on 1.8.6) * RubyGems
sudo gem install parseconfig
Copyright (C) 2006,2007 BJ Dierkes <email@example.com> Copyright (C) 2008-2104 Rails Machine
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.