Module: CovaConfig
- Included in:
- Cova
- Defined in:
- lib/covaconfig.rb
Instance Method Summary collapse
Instance Method Details
#_config_load(conf_file) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/covaconfig.rb', line 3 def _config_load(conf_file) line_sub = Regexp.new(/\s+|"|\[|\]/) temp = Array.new vars=Hash.new unless File.exists?(conf_file) then return vars end IO.foreach(conf_file) do |line| if line.match(/^#/) next elsif line.match(/^$/) next else temp[0],temp[1] = line.to_s.scan(/^.*$/).to_s.split('=') temp.collect! do |val| val.gsub(line_sub, "") end vars[temp[0]] = temp[1] end end return vars end |