summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-16 10:27:57 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-17 18:50:55 +0900
commitb6d3c06936e5aaf94d72f22f0ecca5468146f07f (patch)
treeecb750d0716123802049c3888b4957e2f4768b1d /lib
parent866831d8e9713cbf1b2bcc710a6da81f2b748855 (diff)
util/rubocop -A --only Performance/Casecmp
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/commands/sources_command.rb4
-rw-r--r--lib/rubygems/remote_fetcher.rb2
-rw-r--r--lib/rubygems/request/connection_pools.rb2
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)