From c182092a788bad8d309baa893f56ddb2c79dd0df Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Tue, 17 May 2016 00:11:37 -0500 Subject: [Index] Don't calculate Platform#to_s twice --- lib/bundler/index.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/bundler/index.rb') 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 -- cgit v1.2.1