Method: #read_config

Defined in:
lib/zipf/misc.rb

#read_config(fn) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/zipf/misc.rb', line 99

def read_config fn
  f = ReadFile.new fn
  cfg = {}
  while line = f.gets
    line.strip!
    next if /^\s*$/.match line
    next if line[0]=='#'
    content = line.split('#', 2).first
    k, v = content.split(/\s*=\s*/, 2)
    k.strip!; v.strip!
    cfg[k] = v
  end
  return cfg
end