diff options
Diffstat (limited to 'bin/mog')
-rwxr-xr-x | bin/mog | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -12,13 +12,15 @@ trap('PIPE') { exit 0 } def parse_config_file!(path, overwrite = false) dest = {} File.open(path).each_line do |line| - line.strip! - if /^(domain|class)\s*=\s*(\S+)/.match(line) + case line + when /^(domain|class)\s*=\s*(\S+)/ dest[$1.to_sym] = $2 - elsif m = /^(?:trackers|hosts)\s*=\s*(.*)/.match(line) + when /^(?:trackers|hosts)\s*=\s*(.*)/ dest[:hosts] = $1.split(/\s*,\s*/) - elsif m = /^timeout\s*=\s*(.*)/.match(line) - dest[:timeout] = m[1].to_f + when /^timeout\s*=\s*(.*)/ + dest[:timeout] = $1.to_f + when /^noclobber\s*=\s*true\s*/ + dest[:noclobber] = true else warn "Ignored configuration line: #{line}" unless /^#/.match(line) end |