End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Gem::Util.traverse_parents
traverse_parents(directory, &block)
lib/rubygems/util.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/rubygems/util.rb, line 82
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
Enumerates the parents of directory.