Project

General

Profile

Actions

Feature #11052

closed

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

Added by chastell (Piotr Szotkowski) almost 9 years ago. Updated almost 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

Updated by chastell (Piotr Szotkowski) almost 9 years ago

Apologies if you're busy and I should just wait (happy to do it!), but it's my first non-doc contribution and I'm not sure: is there anything I should add to this feature request?

Actions #3

Updated by hsbt (Hiroshi SHIBATA) almost 9 years ago

  • Status changed from Open to Assigned
  • Assignee set to akr (Akira Tanaka)
Actions #4

Updated by akr (Akira Tanaka) almost 9 years ago

  • Status changed from Assigned to Closed

Applied in changeset r50897.


  • ext/pathname/lib/pathname.rb (descend): Blockless form supported.
    (ascend): Ditto.
    [ruby-core:68820] [Feature #11052] Patch by Piotr Szotkowski.
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0