Skip to content

Commit 3589c6e

Browse files
authored
Merge pull request #6664 from aeroastro/feature/runtime-dependency
Simplify code by Gem::Specification#runtime_dependencies
2 parents 3593ade + 324139a commit 3589c6e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

lib/rubygems/specification.rb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ def conflicts
16921692

16931693
def conficts_when_loaded_with?(list_of_specs) # :nodoc:
16941694
result = list_of_specs.any? do |spec|
1695-
spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
1695+
spec.runtime_dependencies.any? {|dep| (dep.name == name) && !satisfies_requirement?(dep) }
16961696
end
16971697
result
16981698
end
@@ -1702,13 +1702,9 @@ def conficts_when_loaded_with?(list_of_specs) # :nodoc:
17021702

17031703
def has_conflicts?
17041704
return true unless Gem.env_requirement(name).satisfied_by?(version)
1705-
dependencies.any? do |dep|
1706-
if dep.runtime?
1707-
spec = Gem.loaded_specs[dep.name]
1708-
spec && !spec.satisfies_requirement?(dep)
1709-
else
1710-
false
1711-
end
1705+
runtime_dependencies.any? do |dep|
1706+
spec = Gem.loaded_specs[dep.name]
1707+
spec && !spec.satisfies_requirement?(dep)
17121708
end
17131709
rescue ArgumentError => e
17141710
raise e, "#{name} #{version}: #{e.message}"
@@ -2595,8 +2591,7 @@ def to_yaml(opts = {}) # :nodoc:
25952591
def traverse(trail = [], visited = {}, &block)
25962592
trail.push(self)
25972593
begin
2598-
dependencies.each do |dep|
2599-
next unless dep.runtime?
2594+
runtime_dependencies.each do |dep|
26002595
dep.matching_specs(true).each do |dep_spec|
26012596
next if visited.key?(dep_spec)
26022597
visited[dep_spec] = true

0 commit comments

Comments
 (0)