Project

General

Profile

Actions

Feature #11052

closed

[PATCH] Blockless Pathname#ascend and #descend return Enumerator

Added by chastell (Piotr Szotkowski) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Target version:
-
[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

Also available in: Atom PDF

Like0
Like0Like0Like0Like0