summaryrefslogtreecommitdiff
path: root/lib/custodian/util/ping.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 13:10:32 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 13:10:32 +0000
commit1ce0906b3480702085d4596dbb4758c115ab298f (patch)
tree695cd365c2ff73904328a049f3b9cfcc5a0a1abd /lib/custodian/util/ping.rb
parent891b720013f06f092f6be82adad95e5551c696b6 (diff)
Don't use parenthesis aroudn conditions in an if.
Diffstat (limited to 'lib/custodian/util/ping.rb')
-rw-r--r--lib/custodian/util/ping.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/custodian/util/ping.rb b/lib/custodian/util/ping.rb
index 9abc746..4056803 100644
--- a/lib/custodian/util/ping.rb
+++ b/lib/custodian/util/ping.rb
@@ -26,7 +26,7 @@ module Custodian
#
def initialize( hostname )
- raise ArgumentError, "Hostname must not be nil" if ( hostname.nil? )
+ raise ArgumentError, "Hostname must not be nil" if hostname.nil?
raise ArgumentError, "Hostname must be a String" unless hostname.kind_of?( String )
@hostname = hostname
@@ -47,7 +47,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
@@ -59,7 +59,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
@@ -74,7 +74,7 @@ module Custodian
# Return false on error.
#
def run_ping
- if ( is_ipv6? )
+ if is_ipv6?
if ( system( "ping6 -c 1 #{@resolved} 2>/dev/null >/dev/null" ) == true )
return true
end