summaryrefslogtreecommitdiff
path: root/lib/custodian/util
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 14:43:10 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 14:43:10 +0000
commit69acb34d89e05637f04531f4ba8903f1dd887383 (patch)
tree023a3777576237d3b89b7554c00ee2ae1142b0a9 /lib/custodian/util
parentff910ae9491d81085e25d289f61cec72e96e57ef (diff)
Removed trailing whitespace from the code
Diffstat (limited to 'lib/custodian/util')
-rw-r--r--lib/custodian/util/bytemark.rb2
-rw-r--r--lib/custodian/util/dns.rb2
-rw-r--r--lib/custodian/util/ping.rb8
-rw-r--r--lib/custodian/util/timespan.rb8
4 files changed, 10 insertions, 10 deletions
diff --git a/lib/custodian/util/bytemark.rb b/lib/custodian/util/bytemark.rb
index db3304d..99079a1 100644
--- a/lib/custodian/util/bytemark.rb
+++ b/lib/custodian/util/bytemark.rb
@@ -29,7 +29,7 @@ module Custodian
def self.inside?(target)
inside = false
- if BYTEMARK_RANGES.any?{|range| range.include?(IPAddr.new(target))}
+ if BYTEMARK_RANGES.any?{|range| range.include?(IPAddr.new(target))}
inside = true
end
diff --git a/lib/custodian/util/dns.rb b/lib/custodian/util/dns.rb
index b93fef5..95e788f 100644
--- a/lib/custodian/util/dns.rb
+++ b/lib/custodian/util/dns.rb
@@ -61,7 +61,7 @@ module Custodian
timeout(period) do
begin
Socket.getaddrinfo(hostname, 'echo').each do |a|
- resolved = a[3] if a
+ resolved = a[3] if a
end
rescue SocketError
resolved = nil
diff --git a/lib/custodian/util/ping.rb b/lib/custodian/util/ping.rb
index 3b3586e..a4c6075 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
diff --git a/lib/custodian/util/timespan.rb b/lib/custodian/util/timespan.rb
index c0ca4eb..7de76b3 100644
--- a/lib/custodian/util/timespan.rb
+++ b/lib/custodian/util/timespan.rb
@@ -18,14 +18,14 @@ module Custodian
# Handle PM times.
#
if (desc.kind_of? String) &&
- (desc =~ /([0-9]+)pm$/i)
+ (desc =~ /([0-9]+)pm$/i)
desc = $1.dup.to_i + 12
end
#
# Handle AM times.
#
- if desc.kind_of? String
+ if desc.kind_of? String
desc = desc.sub(/am$/, '')
desc = desc.to_i
end
@@ -70,7 +70,7 @@ module Custodian
while (hour != p_end)
valid[hour] = 1
hour += 1
- hour = 0 if hour > 23
+ hour = 0 if hour > 23
end
valid[p_end] = 1
@@ -92,7 +92,7 @@ module Custodian
#
# Default to the current hour, if not specified.
#
- if cur_hour.nil?
+ if cur_hour.nil?
cur_hour = Time.now.hour
end