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.
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
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.
Freeze the state of the IniFile object. Any attempts to change the object will raise an error.
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.