summaryrefslogtreecommitdiff
path: root/lib/rubygems/util.rb
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/util.rb23
1 files changed, 6 insertions, 17 deletions
@@ -109,26 +109,15 @@ module Gem::Util
##
# Enumerates the parents of +directory+.
- def self.traverse_parents directory
return enum_for __method__, directory unless block_given?
here = File.expand_path directory
- start = here
-
- Dir.chdir start
-
- begin
- loop do
- yield here
-
- Dir.chdir '..'
-
- return if Dir.pwd == here # toplevel
-
- here = Dir.pwd
- end
- ensure
- Dir.chdir start
end
end