diff options
Diffstat (limited to 'lib/custodian/util')
-rw-r--r-- | lib/custodian/util/ping.rb | 4 | ||||
-rw-r--r-- | lib/custodian/util/prefix.rb | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/custodian/util/ping.rb b/lib/custodian/util/ping.rb index 21836ac..f0aa15b 100644 --- a/lib/custodian/util/ping.rb +++ b/lib/custodian/util/ping.rb @@ -45,7 +45,7 @@ module Custodian # Does the hostname resolve to an IPv4 address? # def is_ipv4? - if (! @resolved.nil?) && (@resolved =~ /^([0-9]+).([0-9]+).([0-9]+).([0-9]+)$/) + if (!@resolved.nil?) && (@resolved =~ /^([0-9]+).([0-9]+).([0-9]+).([0-9]+)$/) true else false @@ -57,7 +57,7 @@ module Custodian # Does the hostname resolve to an IPv6 address? # def is_ipv6? - if (! @resolved.nil?) && (@resolved =~ /^([a-f0-9:]+)$/i) + if (!@resolved.nil?) && (@resolved =~ /^([a-f0-9:]+)$/i) true else false diff --git a/lib/custodian/util/prefix.rb b/lib/custodian/util/prefix.rb index 743a422..9ac027c 100644 --- a/lib/custodian/util/prefix.rb +++ b/lib/custodian/util/prefix.rb @@ -14,25 +14,25 @@ module Custodian # # Return the custom-prefix to use, if any. # - def Prefix.text() + def Prefix.text # Default to no prefix. - default = "" + default = '' # Look for matches - last one wins. - Dir.glob( "/store/clients/*/custodian-prefix.cfg" ).each do |file| + Dir.glob('/store/clients/*/custodian-prefix.cfg').each do |file| begin - default = File.read( file ) + default = File.read(file) rescue Errno::EACCES # Permission-denied. end end # Remove any newline characters - default.gsub!( /[\r\n]/, '' ) + default.gsub!(/[\r\n]/, '') # Truncate, if required. max = 32 - default = default[0...max] if ( default.length > max ) + default = default[0...max] if (default.length > max) default end |