Project

General

Profile

Feature #16621

Second block parameter of Pathname#glob to be relative path from self

Added by 5.5 (5 5) 9 months ago. Updated 9 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:97110]

Description

I often write such a code:

some_dir = Pathname("some/dir")
some_dir.glob("**/*.html") do |path|
  rel_path = path.relative_path_from(some_dir)
  # ...
end

If Pathname#glob yields the relative path from self as a second block parameter, I can write the above as follows:

Pathname("some/dir").glob("**/*.html") do |path, rel_path|
  # ...
end

Also available in: Atom PDF