Class: Redcar::Scm::Git::ConfigFile
- Inherits:
-
Object
- Object
- Redcar::Scm::Git::ConfigFile
- Defined in:
- plugins/scm_git/lib/scm_git/config_file.rb
Class Method Summary (collapse)
Class Method Details
+ (Object) parse(path)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'plugins/scm_git/lib/scm_git/config_file.rb', line 7 def self.parse(path) f = File.open(path) config = {} current = "" f.each_line do |line| line = line.rstrip if line[0, 1] == "[" and line[line.length - 1, 1] == "]" current = line[1, line.length - 2] config[current] ||= {} elsif line[0, 1] == "\t" line = line[1, line.length - 1] values = line.split(' = ', 2) config[current][values[0]] = values[1] end end f.close config end |