Skip to content

Commit

Permalink
[rubygems/rubygems] Simplify code by Gem::Specification#runtime_depen…
Browse files Browse the repository at this point in the history
  • Loading branch information
aeroastro authored and matzbot committed May 8, 2023
1 parent 6987ec4 commit 5831f7c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/rubygems/specification.rb
Expand Up @@ -1692,7 +1692,7 @@ def conflicts

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
Expand All @@ -1702,13 +1702,9 @@ def conficts_when_loaded_with?(list_of_specs) # :nodoc:

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}"
Expand Down Expand Up @@ -2595,8 +2591,7 @@ def to_yaml(opts = {}) # :nodoc:
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
Expand Down

0 comments on commit 5831f7c

Please sign in to comment.