Skip to content

woodruffw/ruby-inih

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruby-inih

license Gem Version Build Status

A Ruby wrapper for inih, a simple INI parser.

Installation

$ gem install inih

Example

Given the following INI data:

; example.ini
[example]
foo=bar
baz = quux
integer = 10
float = 3.14
bool = true
# load directly from a file
INIH.load "example.ini"
# => {"example"=>{"foo"=>"bar", "baz"=>"quux", "integer"=>10, "float"=>3.14, "bool"=>true}}

# parse from a string
INIH.parse "[section]\nkey=value"
#=> {"section"=>{"key"=>"value"}}

Integers, floating-point numbers, and booleans are coerced into their respective Ruby types by default, unless normalize: false is passed to either method.

TODO

  • Coerce scientific notation?

License

inih itself is licensed under the BSD License.

For the exact terms, see the LICENSE file.

ruby-inih is licensed under the MIT License.

For the exact terms, see the LICENSE file.