Module: INIH
- Defined in:
- lib/inih.rb,
ext/inih/inih.c
Overview
The primary namespace for INIH.
Constant Summary collapse
- VERSION =
The current version of ruby-inih.
"1.1.0"
Class Method Summary collapse
-
.load(filename) ⇒ Hash
Parse an INI-formatted file into a Hash.
-
.normalize(hsh) ⇒ Object
private
Normalize a parsed INI file's values.
-
.normalize_sect(sect) ⇒ Object
private
Normalize the values in a section of a parsed INI file.
-
.parse(string) ⇒ Hash
Parse an INI-formatted string into a Hash.
Class Method Details
.load(filename) ⇒ Hash
23 |
# File 'ext/inih/inih.c', line 23
static VALUE mINIH_load(VALUE self, VALUE filename);
|
.normalize(hsh) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Normalize a parsed INI file's values.
12 13 14 15 16 |
# File 'lib/inih.rb', line 12 def self.normalize(hsh) hsh.map do |k, sect| [k, normalize_sect(sect)] end.to_h end |
.normalize_sect(sect) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Normalize the values in a section of a parsed INI file.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/inih.rb', line 20 def self.normalize_sect(sect) sect.map do |k, v| nv = case v when "" then nil when "true" then true when "false" then false when /\A-?\d+\Z/ then Integer v when /\A-?\d+\.\d+\Z/ then Float v else v end [k, nv] end.to_h end |
.parse(string) ⇒ Hash
14 |
# File 'ext/inih/inih.c', line 14
static VALUE mINIH_parse(VALUE self, VALUE string);
|