Inifile 1.0.0

inifile version 1.0.0
by Tim P.
inifile | RubyGems.org | your community gem host

== DESCRIPTION

Although made popular by Windows, INI files can be used on any system
thanks
to their flexibility. They allow a program to store configuration data,
which
can then be easily parsed and changed. Two notable systems that use the
INI
format are Samba and Trac.

More information about INI files can be found on the Wikipedia
Page
.

== CHANGES

Major Enhancements

  • Changed how multi-line values are handled [issue #7]
  • Added backslash escaping support for values
    Enhancements
  • Inifile merge functionality [Jens Hilligsøe]
  • Use regular expressions to find sections [issue 8]

== INSTALL

gem install inifile

How is this is any better, or easier, than a regular YAML file? Not
only are YAML files very easy to read and write, but the code required
to parse one is not that complicated either.


persons.yml:

persons:
  - name: John
    title: Dr.

  - name: Bob
    title: Mr.

persons.rb:

require 'yaml'

file = File.expand_path '../persons.yml', __FILE__
data = YAML.load File.open(file)

data['persons'].each do |person|
  title = person['title']
  name = person['name']

  puts "Person: #{title} #{name}"
end

Bryan D. wrote in post #1049373:

How is this is any better, or easier, than a regular YAML file? Not
only are YAML files very easy to read and write, but the code required
to parse one is not that complicated either.

Agreed, but that is of no help if you need to parse an existing INI
file.

Tim’s just offering a tool to solve a problem (thanks, Tim!), not
claiming that INI is better than YAML.

David

David,

Good point. The way it was advertised just made it seem like he was
promoting an INI file as a replacement for configuration options.