summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2023-03-22 12:47:40 +0900
committerHiroshi SHIBATA <[email protected]>2023-03-23 17:18:49 +0900
commit01be518eba03e4133a93cbd5dec79678ae430bfc (patch)
tree2b68848baaa491c6e5012a74669fdd997cd46388 /lib
parentec131071b958b2f86e9c043fa65b51f21e2ed72c (diff)
[rubygems/rubygems] util/rubocop -A --only Lint/UnderscorePrefixedVariableName
https://github.com/rubygems/rubygems/commit/6dc4bc3a5b
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7582
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/request.rb12
-rw-r--r--lib/rubygems/specification.rb18
2 files changed, 15 insertions, 15 deletions
diff --git a/lib/rubygems/request.rb b/lib/rubygems/request.rb
index e1f620333d..30e2582ac5 100644
--- a/lib/rubygems/request.rb
+++ b/lib/rubygems/request.rb
@@ -164,14 +164,14 @@ class Gem::Request
# environment variables.
def self.get_proxy_from_env(scheme = "http")
- _scheme = scheme.downcase
- _SCHEME = scheme.upcase
- env_proxy = ENV["#{_scheme}_proxy"] || ENV["#{_SCHEME}_PROXY"]
+ downcase_scheme = scheme.downcase
+ upcase_scheme = scheme.upcase
+ env_proxy = ENV["#{downcase_scheme}_proxy"] || ENV["#{upcase_scheme}_PROXY"]
no_env_proxy = env_proxy.nil? || env_proxy.empty?
if no_env_proxy
- return ["https", "http"].include?(_scheme) ?
+ return ["https", "http"].include?(downcase_scheme) ?
:no_proxy : get_proxy_from_env("http")
end
@@ -179,8 +179,8 @@ class Gem::Request
uri = URI(Gem::UriFormatter.new(env_proxy).normalize)
if uri && uri.user.nil? && uri.password.nil?
- user = ENV["#{_scheme}_proxy_user"] || ENV["#{_SCHEME}_PROXY_USER"]
- password = ENV["#{_scheme}_proxy_pass"] || ENV["#{_SCHEME}_PROXY_PASS"]
+ user = ENV["#{downcase_scheme}_proxy_user"] || ENV["#{upcase_scheme}_PROXY_USER"]
+ password = ENV["#{downcase_scheme}_proxy_pass"] || ENV["#{upcase_scheme}_PROXY_PASS"]
uri.user = Gem::UriFormatter.new(user).escape
uri.password = Gem::UriFormatter.new(password).escape
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 95eb5fc9db..a66d48fc37 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1150,8 +1150,8 @@ class Gem::Specification < Gem::BasicSpecification
def self.load(file)
return unless file
- _spec = @load_cache_mutex.synchronize { @load_cache[file] }
- return _spec if _spec
+ spec = @load_cache_mutex.synchronize { @load_cache[file] }
+ return spec if spec
file = file.dup.tap(&Gem::UNTAINT)
return unless File.file?(file)
@@ -1161,22 +1161,22 @@ class Gem::Specification < Gem::BasicSpecification
code.tap(&Gem::UNTAINT)
begin
- _spec = eval code, binding, file
+ spec = eval code, binding, file
- if Gem::Specification === _spec
- _spec.loaded_from = File.expand_path file.to_s
+ if Gem::Specification === spec
+ spec.loaded_from = File.expand_path file.to_s
@load_cache_mutex.synchronize do
prev = @load_cache[file]
if prev
- _spec = prev
+ spec = prev
else
- @load_cache[file] = _spec
+ @load_cache[file] = spec
end
end
- return _spec
+ return spec
end
- warn "[#{file}] isn't a Gem::Specification (#{_spec.class} instead)."
+ warn "[#{file}] isn't a Gem::Specification (#{spec.class} instead)."
rescue SignalException, SystemExit
raise
rescue SyntaxError, StandardError => e