diff options
author | Takumasa Ochi <aeroastro007@gmail.com> | 2023-05-08 13:51:46 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-05-08 08:56:22 +0000 |
commit | 5831f7c83177d6214aee1165df694bb4d4ae8ec6 (patch) | |
tree | 292664a71860c85b49af824fba87b1f0c1a1b0aa /lib | |
parent | 6987ec45b18924e9dcbf1439fe92a2ab7c7fc8bd (diff) |
[rubygems/rubygems] Simplify code by Gem::Specification#runtime_dependencies
https://github.com/rubygems/rubygems/commit/324139af8f
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems/specification.rb | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 8498dc6363..abdc1dbf4b 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -1692,7 +1692,7 @@ class Gem::Specification < Gem::BasicSpecification def conficts_when_loaded_with?(list_of_specs) # :nodoc: result = list_of_specs.any? do |spec| - spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) } + spec.runtime_dependencies.any? {|dep| (dep.name == name) && !satisfies_requirement?(dep) } end result end @@ -1702,13 +1702,9 @@ class Gem::Specification < Gem::BasicSpecification def has_conflicts? return true unless Gem.env_requirement(name).satisfied_by?(version) - dependencies.any? do |dep| - if dep.runtime? - spec = Gem.loaded_specs[dep.name] - spec && !spec.satisfies_requirement?(dep) - else - false - end + runtime_dependencies.any? do |dep| + spec = Gem.loaded_specs[dep.name] + spec && !spec.satisfies_requirement?(dep) end rescue ArgumentError => e raise e, "#{name} #{version}: #{e.message}" @@ -2595,8 +2591,7 @@ class Gem::Specification < Gem::BasicSpecification def traverse(trail = [], visited = {}, &block) trail.push(self) begin - dependencies.each do |dep| - next unless dep.runtime? + runtime_dependencies.each do |dep| dep.matching_specs(true).each do |dep_spec| next if visited.key?(dep_spec) visited[dep_spec] = true |