summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-05-17 00:11:37 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-06-02 16:51:13 -0500
commitc182092a788bad8d309baa893f56ddb2c79dd0df (patch)
tree3523fa3970af4a8d774d932d96b0ec221fb80ae2
parent61ff4765639323e6791277760db4747268dd046d (diff)
downloadbundler-c182092a788bad8d309baa893f56ddb2c79dd0df.tar.gz
[Index] Don't calculate Platform#to_s twice
-rw-r--r--lib/bundler/index.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index 9e7dba8472..729d5f2f46 100644
--- a/lib/bundler/index.rb
+++ b/lib/bundler/index.rb
@@ -68,7 +68,10 @@ module Bundler
end
end
- results.sort_by {|s| [s.version, s.platform.to_s == RUBY ? NULL : s.platform.to_s] }
+ results.sort_by do |s|
+ platform_string = s.platform.to_s
+ [s.version, platform_string == RUBY ? NULL : platform_string]
+ end
end
def local_search(query, base = nil)
@@ -112,8 +115,8 @@ module Bundler
def use(other, override_dupes = false)
return unless other
other.each do |s|
- if (dupes = search_by_spec(s)) && dupes.any?
- @all_specs[s.name] = [s] + dupes
+ if (dupes = search_by_spec(s)) && !dupes.empty?
+ @all_specs[s.name] = dupes + [s]
next unless override_dupes
self << s
end