diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:19:47 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:19:47 +0000 |
commit | 54b21cf54c51dfe40784a8096f84c7a80b015bd4 (patch) | |
tree | 4763692624732650daf1a9e02c91576d3f7ee8d0 /lib/custodian/util/ping.rb | |
parent | a22b8e96ead33b0f97ed5243dbad7f7b6cd5135d (diff) |
Removed spaces inside parenthesis.
Diffstat (limited to 'lib/custodian/util/ping.rb')
-rw-r--r-- | lib/custodian/util/ping.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/custodian/util/ping.rb b/lib/custodian/util/ping.rb index cf79754..f8b7c75 100644 --- a/lib/custodian/util/ping.rb +++ b/lib/custodian/util/ping.rb @@ -24,13 +24,13 @@ module Custodian # # Save the hostname away, resolve it if possible. # - def initialize( hostname ) + def initialize(hostname) raise ArgumentError, 'Hostname must not be nil' if hostname.nil? - raise ArgumentError, 'Hostname must be a String' unless hostname.kind_of?( String ) + raise ArgumentError, 'Hostname must be a String' unless hostname.kind_of?(String) @hostname = hostname - @resolved = Custodian::Util::DNS.hostname_to_ip( hostname ) + @resolved = Custodian::Util::DNS.hostname_to_ip(hostname) end @@ -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 @@ -75,11 +75,11 @@ module Custodian # def run_ping if is_ipv6? - if ( system( "ping6 -c 1 #{@resolved} 2>/dev/null >/dev/null" ) == true ) + if (system("ping6 -c 1 #{@resolved} 2>/dev/null >/dev/null") == true) return true end - elsif( is_ipv4? ) - if ( system( "ping -c 1 #{@resolved} 2>/dev/null >/dev/null" ) == true ) + elsif(is_ipv4?) + if (system("ping -c 1 #{@resolved} 2>/dev/null >/dev/null") == true) return true end else |