summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Šimánek <[email protected]>2023-03-24 20:41:46 +0100
committerHiroshi SHIBATA <[email protected]>2023-03-28 15:27:35 +0900
commit1cbb5011274399527c26eb3c6dd98c7947140f83 (patch)
treea08228826d485d03d6aa6386d9dbfecf4ed4f385
parent2322b189b6ac650199f09895dd9870fc0466d492 (diff)
Onboard Rubocop Naming/MemoizedInstanceVariableName rule to RubyGems.
-rw-r--r--lib/rubygems/command_manager.rb4
-rw-r--r--lib/rubygems/installer.rb2
-rw-r--r--lib/rubygems/request_set.rb4
-rw-r--r--lib/rubygems/specification.rb4
-rw-r--r--lib/rubygems/stub_specification.rb3
5 files changed, 10 insertions, 7 deletions
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index 1a0ad2ad8a..c53f0231af 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -84,7 +84,7 @@ class Gem::CommandManager
# Return the authoritative instance of the command manager.
def self.instance
- @command_manager ||= new
+ @instance ||= new
end
##
@@ -99,7 +99,7 @@ class Gem::CommandManager
# Reset the authoritative instance of the command manager.
def self.reset
- @command_manager = nil
+ @instance = nil
end
##
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index f252abf296..fdb2944272 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -387,7 +387,7 @@ class Gem::Installer
# we'll be installing into.
def installed_specs
- @specs ||= begin
+ @installed_specs ||= begin
specs = []
Gem::Util.glob_files_in_dir("*.gemspec", File.join(gem_home, "specifications")).each do |path|
diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
index e1447ad49b..46e9cc346c 100644
--- a/lib/rubygems/request_set.rb
+++ b/lib/rubygems/request_set.rb
@@ -108,7 +108,7 @@ class Gem::RequestSet
@requests = []
@sets = []
@soft_missing = false
- @sorted = nil
+ @sorted_requests = nil
@specs = nil
@vendor_set = nil
@source_set = nil
@@ -426,7 +426,7 @@ class Gem::RequestSet
end
def sorted_requests
- @sorted ||= strongly_connected_components.flatten
+ @sorted_requests ||= strongly_connected_components.flatten
end
def specs
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 8ad95cc3fe..8498dc6363 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -2236,7 +2236,7 @@ class Gem::Specification < Gem::BasicSpecification
# The platform this gem runs on. See Gem::Platform for details.
def platform
- @new_platform ||= Gem::Platform::RUBY
+ @new_platform ||= Gem::Platform::RUBY # rubocop:disable Naming/MemoizedInstanceVariableName
end
def pretty_print(q) # :nodoc:
@@ -2711,6 +2711,8 @@ class Gem::Specification < Gem::BasicSpecification
end
@installed_by_version ||= nil
+
+ nil
end
def flatten_require_paths # :nodoc:
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb
index 975e250c36..a3793eaa20 100644
--- a/lib/rubygems/stub_specification.rb
+++ b/lib/rubygems/stub_specification.rb
@@ -182,7 +182,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
##
# The full Gem::Specification for this gem, loaded from evalling its gemspec
- def to_spec
+ def spec
@spec ||= if @data
loaded = Gem.loaded_specs[name]
loaded if loaded && loaded.version == version
@@ -190,6 +190,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
@spec ||= Gem::Specification.load(loaded_from)
end
+ alias_method :to_spec, :spec
##
# Is this StubSpecification valid? i.e. have we found a stub line, OR does