Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby Config File Parser for Standard Unix/Linux Type Config Files
Ruby CSS
branch: master

Merge pull request #25 from nleib/master

Update parseconfig.rb
latest commit 1f47e6745e
@derks derks authored

Ruby ParseConfig Library

ParseConfig provides simple parsing of standard configuration files in the form of 'param = value'. It also supports nested [group] sections.

Continuous Integration Status


$ sudo gem install parseconfig


 gem 'parseconfig'


An example configuration file might look like:

# Example Config
param1 = value1
param2 = value2

group1_param1 = group1_value1
group1_param2 = group1_value2

group2_param1 = group2_value1
group2_param2 = group2_value2

Access it with ParseConfig:

>> require 'parseconfig'
=> true

>> config ='/path/to/config/example.conf')
=> #<ParseConfig:0x102410908
      @groups=["group1", "group2"],

>> config.get_params
=> ["param1", "param2", "group1", "group2"]

>> config['param1']
=> "value1"

>> config.get_groups
=> ["group1", "group2"]

>> config['group1']
=> {"group1_param1"=>"group1_value1", "group1_param2"=>"group1_value2"}

>> config['group1']['group1_param1']
=> "group1_value1"

>> file ='/path/to/config/file', 'w')
=> #<File:file>
>> config.write(file)
=> []
>> file.close
=> nil


The ParseConfig library is Open Source and distributed under the MIT license. Please see the LICENSE file included with this software.

Something went wrong with that request. Please try again.