Method: IniFile.load
- Defined in:
- lib/inifile.rb
.load(filename, opts = {}) ⇒ Object
Public: Open an INI file and load the contents.
filename - The name of the fiel as a String opts - The Hash of options (default: {})
:comment - String containing the comment character(s)
:parameter - String used to separate parameter and value
:encoding - Encoding String for reading / writing (Ruby 1.9)
:escape - Boolean used to control character escaping
:default - The String name of the default global section
Examples
IniFile.load('file.ini')
#=> IniFile instance
IniFile.load('does/not/exist.ini')
#=> nil
Returns an IniFile intsnace or nil if the file could not be opened.
33 34 35 36 |
# File 'lib/inifile.rb', line 33 def self.load( filename, opts = {} ) return unless File.file? filename new(opts.merge(:filename => filename)) end |