From b6d3c06936e5aaf94d72f22f0ecca5468146f07f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 16 Mar 2023 10:27:57 +0900 Subject: [PATCH] util/rubocop -A --only Performance/Casecmp --- lib/rubygems/commands/sources_command.rb | 4 ++-- lib/rubygems/remote_fetcher.rb | 2 +- lib/rubygems/request/connection_pools.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb index aa2fdd9239..239b4f5884 100644 --- a/lib/rubygems/commands/sources_command.rb +++ b/lib/rubygems/commands/sources_command.rb @@ -82,8 +82,8 @@ Do you want to add this source? def check_rubygems_https(source_uri) # :nodoc: uri = URI source_uri - if uri.scheme && uri.scheme.downcase == "http" && - uri.host.downcase == "rubygems.org" + if uri.scheme && uri.scheme.casecmp("http").zero? && + uri.host.casecmp("rubygems.org").zero? question = <<-QUESTION.chomp https://rubygems.org is recommended for security over #{uri} diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb index d33bfd2668..708b93209f 100644 --- a/lib/rubygems/remote_fetcher.rb +++ b/lib/rubygems/remote_fetcher.rb @@ -320,7 +320,7 @@ class Gem::RemoteFetcher end def https?(uri) - uri.scheme.downcase == "https" + uri.scheme.casecmp("https").zero? end def close_all diff --git a/lib/rubygems/request/connection_pools.rb b/lib/rubygems/request/connection_pools.rb index 44280489fb..38f8db4ce0 100644 --- a/lib/rubygems/request/connection_pools.rb +++ b/lib/rubygems/request/connection_pools.rb @@ -45,7 +45,7 @@ class Gem::Request::ConnectionPools # :nodoc: end def https?(uri) - uri.scheme.downcase == "https" + uri.scheme.casecmp("https").zero? end def no_proxy?(host, env_no_proxy)