about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rwxr-xr-xbin/mog12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/mog b/bin/mog
index f46e0e7..c312790 100755
--- a/bin/mog
+++ b/bin/mog
@@ -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