diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-12-24 18:44:47 +0100 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-12-25 07:54:51 -0600 |
commit | b747bd79f33e8e0c6dc12ba3ad72ecb64dcbe214 (patch) | |
tree | 440d8f63906ac86a51b69f8d7d1b0f99019c040a /lib | |
parent | 9df212e38c0362fe616c1cfa56263e1894fdbc51 (diff) | |
download | bundler-b747bd79f33e8e0c6dc12ba3ad72ecb64dcbe214.tar.gz |
[Index] Avoid uncessary array allocations for dependency_names
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/index.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb index 52b9032dda..4fe1418773 100644 --- a/lib/bundler/index.rb +++ b/lib/bundler/index.rb @@ -109,15 +109,18 @@ module Bundler # returns a list of the dependencies def unmet_dependency_names - names = dependency_names - names.delete_if {|n| n == "bundler" } - names.select {|n| search(n).empty? } + dependency_names.select do |name| + name != "bundler" && search(name).empty? + end end def dependency_names names = [] - each do |s| - names.concat(s.dependencies.select {|d| d.type != :development }.map(&:name)) + each do |spec| + spec.dependencies.each do |dep| + next if dep.type == :development + names << dep.name + end end names.uniq end |