diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-03-16 13:12:38 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-03-17 18:50:55 +0900 |
commit | 1ca67f13cd2ebb643fc924246cc790f14b26480d (patch) | |
tree | 0551499a620d3d3d034681b107aedda4019b710e /lib/rubygems/specification.rb | |
parent | 5211900d37573a82c1bdf7cb2354937cc4022ae1 (diff) | |
download | ruby-1ca67f13cd2ebb643fc924246cc790f14b26480d.tar.gz |
util/rubocop -A --only Style/RedundantSelf
Diffstat (limited to 'lib/rubygems/specification.rb')
-rw-r--r-- | lib/rubygems/specification.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index d1079cc42c..35e599ed00 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -938,7 +938,7 @@ class Gem::Specification < Gem::BasicSpecification # Return full names of all specs in sorted order. def self.all_names - self._all.map(&:full_name) + _all.map(&:full_name) end ## @@ -973,7 +973,7 @@ class Gem::Specification < Gem::BasicSpecification # this resets the list of known specs. def self.dirs=(dirs) - self.reset + reset @@dirs = Array(dirs).map {|dir| File.join dir, "specifications" } end @@ -987,7 +987,7 @@ class Gem::Specification < Gem::BasicSpecification def self.each return enum_for(:each) unless block_given? - self._all.each do |x| + _all.each do |x| yield x end end @@ -1418,7 +1418,7 @@ class Gem::Specification < Gem::BasicSpecification # there are conflicts upon activation. def activate - other = Gem.loaded_specs[self.name] + other = Gem.loaded_specs[name] if other check_version_conflict other return false @@ -1429,7 +1429,7 @@ class Gem::Specification < Gem::BasicSpecification activate_dependencies add_self_to_load_path - Gem.loaded_specs[self.name] = self + Gem.loaded_specs[name] = self @activated = true @loaded = true @@ -1444,7 +1444,7 @@ class Gem::Specification < Gem::BasicSpecification def activate_dependencies unresolved = Gem::Specification.unresolved_deps - self.runtime_dependencies.each do |spec_dep| + runtime_dependencies.each do |spec_dep| if loaded = Gem.loaded_specs[spec_dep.name] next if spec_dep.matches_spec? loaded @@ -1458,7 +1458,7 @@ class Gem::Specification < Gem::BasicSpecification begin specs = spec_dep.to_specs rescue Gem::MissingSpecError => e - raise Gem::MissingSpecError.new(e.name, e.requirement, "at: #{self.spec_file}") + raise Gem::MissingSpecError.new(e.name, e.requirement, "at: #{spec_file}") end if specs.size == 1 @@ -1677,7 +1677,7 @@ class Gem::Specification < Gem::BasicSpecification def conflicts conflicts = {} - self.runtime_dependencies.each do |dep| + runtime_dependencies.each do |dep| spec = Gem.loaded_specs[dep.name] if spec && !spec.satisfies_requirement?(dep) (conflicts[spec] ||= []) << dep @@ -1703,7 +1703,7 @@ class Gem::Specification < Gem::BasicSpecification def has_conflicts? return true unless Gem.env_requirement(name).satisfied_by?(version) - self.dependencies.any? do |dep| + dependencies.any? do |dep| if dep.runtime? spec = Gem.loaded_specs[dep.name] spec && !spec.satisfies_requirement?(dep) @@ -1808,7 +1808,7 @@ class Gem::Specification < Gem::BasicSpecification Gem::Specification.each do |spec| deps = check_dev ? spec.dependencies : spec.runtime_dependencies deps.each do |dep| - if self.satisfies_requirement?(dep) + if satisfies_requirement?(dep) sats = [] find_all_satisfiers(dep) do |sat| sats << sat @@ -2251,7 +2251,7 @@ class Gem::Specification < Gem::BasicSpecification attributes.unshift :name attributes.each do |attr_name| - current_value = self.send attr_name + current_value = send attr_name current_value = current_value.sort if %i[files test_files].include? attr_name if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name) @@ -2277,7 +2277,7 @@ class Gem::Specification < Gem::BasicSpecification # that is already loaded (+other+) def check_version_conflict(other) # :nodoc: - return if self.version == other.version + return if version == other.version # This gem is already loaded. If the currently loaded gem is not in the # list of candidate gems, then we have a version conflict. @@ -2285,7 +2285,7 @@ class Gem::Specification < Gem::BasicSpecification msg = "can't activate #{full_name}, already activated #{other.full_name}" e = Gem::LoadError.new msg - e.name = self.name + e.name = name raise e end @@ -2377,7 +2377,7 @@ class Gem::Specification < Gem::BasicSpecification # True if this gem has the same attributes as +other+. def same_attributes?(spec) - @@attributes.all? {|name, _default| self.send(name) == spec.send(name) } + @@attributes.all? {|name, _default| send(name) == spec.send(name) } end private :same_attributes? @@ -2514,7 +2514,7 @@ class Gem::Specification < Gem::BasicSpecification @@attributes.each do |attr_name| next if handled.include? attr_name - current_value = self.send(attr_name) + current_value = send(attr_name) if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name) result << " s.#{attr_name} = #{ruby_code current_value}" end @@ -2706,7 +2706,7 @@ class Gem::Specification < Gem::BasicSpecification end nil_attributes.each do |attribute| - default = self.default_value attribute + default = default_value attribute value = case default when Time, Numeric, Symbol, true, false, nil then default |