diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-09-28 03:48:08 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-09-28 03:48:08 -0700 |
commit | 10e861a690a61b613a8c9c6e2b8b998241fbbe50 (patch) | |
tree | 63fb60a8b824a7949a99ef738ff4a6900b66f023 /lognotify.rb | |
parent | fc8bd34adb6763e236e960b36e52893f7f697add (diff) | |
download | lognotify-10e861a690a61b613a8c9c6e2b8b998241fbbe50.tar.gz lognotify-10e861a690a61b613a8c9c6e2b8b998241fbbe50.tar.xz |
Shorthand if statements are better.
Diffstat (limited to 'lognotify.rb')
-rwxr-xr-x | lognotify.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lognotify.rb b/lognotify.rb index 1296506..c3ff293 100755 --- a/lognotify.rb +++ b/lognotify.rb @@ -14,8 +14,8 @@ def parse identifier conf = Hash.new file = File.expand_path(CONFIG_DIR + '/' + identifier + '.conf') - File.open(file) do |contents| - contents.each_line do |line| + File.open(file) do |io| + io.each_line do |line| # Remove whitespace from beginning of line, allowing for indentation. line.lstrip! @@ -24,9 +24,7 @@ def parse identifier key, value = line.split('=', 2) # Raise an error if line does not contain a key/value pair. - if value.nil? - raise 'Check line ' + contents.lineno.to_s + ' for errors.' - end + raise 'Check line ' + io.lineno.to_s + ' for errors.' if value.nil? conf[key.strip.to_sym] = value.strip end |