diff options
author | Steve Kemp <steve@steve.org.uk> | 2016-04-22 22:05:25 +0300 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2016-04-22 22:05:25 +0300 |
commit | 9366c1eda2967d6931efd6e73134dc79fb8a5cd2 (patch) | |
tree | 3498a027feacef099a824d91e6fb4c51e46a5ddf /lib | |
parent | a5ad0029b634a19d4d50e9f49c51903c2fa82208 (diff) |
Updated to fix the last remaining rubocop warnings.
This involved silencing a few issues that were judged to be minor,
and changing various whitespaces and function-calls. The most
obvious example was changing this:
assert(ret.kind_of? Array)
To this:
assert(ret.kind_of?(Array))
Diffstat (limited to 'lib')
-rw-r--r-- | lib/custodian/parser.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb index ae771db..941a549 100644 --- a/lib/custodian/parser.rb +++ b/lib/custodian/parser.rb @@ -65,7 +65,7 @@ module Custodian # def get_url_contents(uri_str) begin - uri_str = 'http://' + uri_str unless uri_str.match(/^http/) + uri_str = 'http://' + uri_str unless uri_str =~ /^http/ url = URI.parse(uri_str) http = Net::HTTP.new(url.host, url.port) @@ -96,7 +96,7 @@ module Custodian case response when Net::HTTPRedirection then - newURL = response['location'].match(/^http/) ? response['Location'] : uri_str + response['Location'] + newURL = (response['location'] =~ /^http/) ? response['Location'] : uri_str + response['Location'] return(get_url_contents(newURL)) else return response.body @@ -138,7 +138,7 @@ module Custodian text = get_url_contents(uri) text.split(/[\r\n]/).each do |line| - val.push(line) if line.length > 0 + val.push(line) if !line.empty? end elsif line =~ /\s(is|are)\s+(.*)\.*$/ @@ -245,7 +245,7 @@ module Custodian # # A blank line, or a comment may be skipped. # - return nil if (line.nil?) || (line =~ /^#/) || (line.length < 1) + return nil if (line.nil?) || (line =~ /^#/) || (line.empty?) # # Look for a time period. @@ -411,7 +411,7 @@ module Custodian def parse_file(filename) raise ArgumentError, 'Missing configuration file!' if filename.nil? - raise ArgumentError, "File not found: #{@file}" unless File.exist?(filename) + raise ArgumentError, "File not found: #{@file}" unless File.exist?(filename) # # Read the configuration file. |