Top Level Namespace

Defined Under Namespace

Modules: Gmail

Instance Method Summary collapse

Instance Method Details

#read_configObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'bin/gmail', line 32

def read_config
  config = {}
  group = nil
  File.foreach("#{ENV['HOME']}/.gmail") do |line|
    line.strip!
    if line[0] != ?# and line =~ /\S/
      if line =~ /^\[(.*)\]$/
        group = $1
      else
        key, value = line.split("=")
        value ||= ''
        (config[group]||={})[key.strip] = value.strip
      end
    end
  end
  config
end