traverse_parents(directory, &block)
public
Enumerates the parents of directory.
# File lib/rubygems/util.rb, line 112
def self.traverse_parents directory, &block
return enum_for __method__, directory unless block_given?
here = File.expand_path directory
loop do
Dir.chdir here, &block rescue Errno::EACCES
new_here = File.expand_path('..', here)
return if new_here == here # toplevel
here = new_here
end
end