summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-02-02 10:38:50 -0600
committerSamuel Giddins <segiddins@segiddins.me>2016-02-02 10:38:50 -0600
commitb0ee2bbb5faade27bf1e3c35c7428e788d5bf239 (patch)
tree96cc254fbe117c4a4871a29f984a000835c935dc
parent5b639c3d774e4a83f1a15ec15e16b3e777c79642 (diff)
downloadbundler-seg-simplify-exec.tar.gz
Avoid accessing the ENV hash twice in Bundler.whichseg-simplify-exec
-rw-r--r--lib/bundler.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 2e7f324002..b0f166040f 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -293,12 +293,12 @@ module Bundler
def which(executable)
if File.file?(executable) && File.executable?(executable)
executable
- elsif ENV["PATH"]
- path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |p|
+ elsif path = ENV["PATH"]
+ executable_path = path.split(File::PATH_SEPARATOR).find do |p|
abs_path = File.join(p, executable)
File.file?(abs_path) && File.executable?(abs_path)
end
- path && File.expand_path(executable, path)
+ executable_path && File.expand_path(executable, executable_path)
end
end