Class Ini
In: lib/ini.rb
Parent: Object

This class represents the INI file and can be used to parse, modify, and write INI files.

Methods

==   []   clone   delete_section   dup   each   each_section   eql?   freeze   has_section?   load   new   save   sections   taint   write  

Public Class methods

Open the given filename and load the contetns of the INI file. The following options can be passed to this method:

   :comment => ';'      The line comment character(s)
   :parameter => '='    The parameter / value separator

Create a new INI file using the given filename. If filename exists and is a regular file, then its contents will be parsed. The following options can be passed to this method:

   :comment => ';'      The line comment character(s)
   :parameter => '='    The parameter / value separator

Public Instance methods

==( other )

Alias for eql?

Get the hash of parameter/value pairs for the given section. If the section hash does not exist it will be created.

Produces a duplicate of this INI file. The duplicate is independent of the original — i.e. the duplicate can be modified without changing the orgiinal. The tainted state and the frozen state of the original is copied to the duplicate.

Deletes the named section from the INI file. Returns the parameter / value pairs if the section exists in the INI file. Otherwise, returns nil.

Produces a duplicate of this INI file. The duplicate is independent of the original — i.e. the duplicate can be modified without changing the orgiinal. The tainted state of the original is copied to the duplicate.

Yield each section, parameter, value in turn to the given block. The method returns immediately if no block is supplied.

Yield each section in turn to the given block. The method returns immediately if no block is supplied.

Returns true if the other object is equivalent to this INI file. For two INI files to be equivalent, they must have the same sections with the same parameter / value pairs in each section.

Freeze the state of the IniFile object. Any attempts to change the object will raise an error.

Returns true if the named section exists in the INI file.

save( filename = nil )

Alias for write

Returns an array of the section names.

Marks the INI file as tainted — this will traverse each section marking each section as tainted as well.

Write the INI file contents to the filesystem. The given filename will be used to write the file. If filename is not given, then the named used when constructing this object will be used.

[Validate]