encoding: us-ascii
INI File Parser Version: 0.1 License: Public Domain Author: Dice <scl@dc.littlestar.jp>
(Not documented)
# File ini.rb, line 15 def self.parse(text, filename = self.to_s) re = {} current_section = nil text.each_with_index do |line, index| case line.chomp when /^\;/, /^\s*$/ # skip (primary) when /^\[(.+)\]/ # section start current_section = $1 if re[current_section] then self.warn(filename, index+1, "section '#{$1}' overlap") else re[current_section] = {} end when /^(.+?)\s*=\s*(.*)$/ # key and value if current_section then if re[current_section][$1] then self.warn(filename, index+1, "key '#{$1}' overlap") end re[current_section][$1] = $2 else self.warn(filename, index+1, "'#{$1}' is not in section") end else self.warn(filename, index+1, "warning: unknown statement") end end re end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.