Onboard Rubocop Naming/MemoizedInstanceVariableName rule to RubyGems.

This commit is contained in:
Josef Šimánek 2023-03-24 20:41:46 +01:00 committed by Hiroshi SHIBATA
parent 2322b189b6
commit 1cbb501127
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2
5 changed files with 10 additions and 7 deletions

View File

@ -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
##

View File

@ -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|

View File

@ -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

View File

@ -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:

View File

@ -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