diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-09-28 11:00:32 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-09-28 11:00:32 -0700 |
commit | 0b05840d82b9502b74047a31aeca3d38af9583d3 (patch) | |
tree | e9c372679bddbf0de53c1550f6fe8d68b3bd22c6 | |
parent | f2f00965676360bab8a4e0b2e1dbf35525a3569e (diff) | |
download | lognotify-0b05840d82b9502b74047a31aeca3d38af9583d3.tar.gz lognotify-0b05840d82b9502b74047a31aeca3d38af9583d3.tar.xz |
More consistent variable names.
-rwxr-xr-x | lognotify.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lognotify.rb b/lognotify.rb index 30875a0..61ea27c 100755 --- a/lognotify.rb +++ b/lognotify.rb @@ -15,10 +15,10 @@ CONFIG_DIR="~/.config/lognotify" # Configuration file parser. def parse identifier conf = Hash.new - file = File.expand_path(CONFIG_DIR + '/' + identifier + '.conf') + path = File.expand_path(CONFIG_DIR + '/' + identifier + '.conf') - File.open(file) do |contents| - contents.each_line do |line| + File.open(path) do |file| + file.each_line do |line| # Remove whitespace from beginning of line, allowing for indentation. line.lstrip! @@ -27,7 +27,7 @@ def parse identifier key, value = line.split('=', 2) # Raise an error if line does not contain a key/value pair. - raise 'Error reading line ' + contents.lineno.to_s + '.' if value.nil? + raise 'Error reading line ' + file.lineno.to_s + '.' if value.nil? conf[key.strip.to_sym] = value.strip end @@ -39,8 +39,8 @@ end # Count lines in cached log. def count_lines identifier - file = File.expand_path(CACHE_DIR + '/' + identifier + '.log') - return File.open(file).readlines.length + path = File.expand_path(CACHE_DIR + '/' + identifier + '.log') + return File.open(path).readlines.length end # Retrieve new lines via SSH. |