Actions
Feature #11052
closed[PATCH] Blockless Pathname#ascend and #descend return Enumerator
[ruby-core:<unknown>]
Description
It would be beneficial for blockless Pathname#ascend
and #descend
to return an Enumerator
(rather than raise a LocalJumpError
).
Example use case of finding the Git root of the current directory:
git_dir = Pathname.new('.git')
Pathname.pwd.ascend.find { |dir| dir.entries.include?(git_dir) }
Files
Actions
Like0
Like0Like0Like0Like0