From 262c7d9360b23cb06d60f0b0692379555e691274 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 9 Mar 2015 12:52:08 +0000 Subject: Avoid redundent ".to_s" methods. These are not required if the argument is string already, or has a _to_s method which will be automatically invoked by magic. --- bin/custodian-dequeue | 2 +- bin/custodian-enqueue | 2 +- bin/custodian-queue | 2 +- lib/custodian/protocoltest/http.rb | 2 +- lib/custodian/protocoltest/ssl.rb | 8 ++++---- lib/custodian/worker.rb | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/custodian-dequeue b/bin/custodian-dequeue index 349ff31..c5c5309 100755 --- a/bin/custodian-dequeue +++ b/bin/custodian-dequeue @@ -90,7 +90,7 @@ if __FILE__ == $PROGRAM_NAME then end end rescue StandardError => ex - puts "Option parsing failed: #{ex.to_s}" + puts "Option parsing failed: #{ex}" exit end diff --git a/bin/custodian-enqueue b/bin/custodian-enqueue index 75d38ac..dec83cb 100755 --- a/bin/custodian-enqueue +++ b/bin/custodian-enqueue @@ -91,7 +91,7 @@ if __FILE__ == $PROGRAM_NAME then end end rescue StandardError => ex - puts "Option parsing failed: #{ex.to_s}" + puts "Option parsing failed: #{ex}" exit end diff --git a/bin/custodian-queue b/bin/custodian-queue index ed2c3be..48c6edc 100755 --- a/bin/custodian-queue +++ b/bin/custodian-queue @@ -88,7 +88,7 @@ if __FILE__ == $PROGRAM_NAME then end end rescue StandardError => ex - puts "Option parsing failed: #{ex.to_s}" + puts "Option parsing failed: #{ex}" exit end diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb index cc171a6..0d20dfb 100644 --- a/lib/custodian/protocoltest/http.rb +++ b/lib/custodian/protocoltest/http.rb @@ -297,7 +297,7 @@ module Custodian # Nothing to see here..! resolution_errors << resolve_mode rescue => x - errors << "#{protocol_msg}: #{x.class.to_s}: #{x.message}\n #{x.backtrace.join("\n ")}." + errors << "#{protocol_msg}: #{x.class}: #{x.message}\n #{x.backtrace.join("\n ")}." end # diff --git a/lib/custodian/protocoltest/ssl.rb b/lib/custodian/protocoltest/ssl.rb index ab57dff..18da9f1 100644 --- a/lib/custodian/protocoltest/ssl.rb +++ b/lib/custodian/protocoltest/ssl.rb @@ -178,10 +178,10 @@ class SSLCheck ctx = OpenSSL::SSL::SSLContext.new(:SSLv3_client) retry end - self.errors << verbose("*Caught #{err.class}* (#{err.to_s}) when connecting to #{uri.host}:#{uri.port}") + self.errors << verbose("*Caught #{err.class}* (#{err}) when connecting to #{uri.host}:#{uri.port}") rescue StandardError, Timeout::Error => err - self.errors << verbose("*Caught #{err.class}* (#{err.to_s}) when connecting to #{uri.host}:#{uri.port}") + self.errors << verbose("*Caught #{err.class}* (#{err}) when connecting to #{uri.host}:#{uri.port}") ensure s.close if s.respond_to?(:close) and !s.closed? end @@ -227,7 +227,7 @@ class SSLCheck # return true rescue StandardError, Timeout::Error => err - self.errors << verbose("*Caught #{err.class}* (#{err.to_s}) when connecting to #{uri.host}:#{uri.port} using SSLv3") + self.errors << verbose("*Caught #{err.class}* (#{err}) when connecting to #{uri.host}:#{uri.port} using SSLv3") ensure s.close if s.respond_to?(:close) and !s.closed? end @@ -313,7 +313,7 @@ class SSLCheck # including any bundle that has been uploaded. # elsif self.certificate_store.is_a?(OpenSSL::X509::Store) and self.certificate_store.verify(self.certificate) - verbose "Certificate signed by #{self.certificate.issuer.to_s}" + verbose "Certificate signed by #{self.certificate.issuer}" return true # diff --git a/lib/custodian/worker.rb b/lib/custodian/worker.rb index df9e117..b411c00 100644 --- a/lib/custodian/worker.rb +++ b/lib/custodian/worker.rb @@ -148,7 +148,7 @@ module Custodian begin - log_message( "Acquired job: #{test.to_s}" ) + log_message( "Acquired job: #{test}" ) # # The count of times this test has run, the result, and the start-time -- cgit v1.2.1