Project

General

Profile

Actions

Feature #16621

open

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

Added by 5.5 (5 5) about 4 years ago. Updated about 4 years ago.

Status:
Open
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
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0