Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pathname#pathmap is still (erronously) documented #348

Open
jasonkarns opened this issue Apr 17, 2020 · 3 comments
Open

Pathname#pathmap is still (erronously) documented #348

jasonkarns opened this issue Apr 17, 2020 · 3 comments

Comments

@jasonkarns
Copy link
Contributor

jasonkarns commented Apr 17, 2020

The rake docs here still indicate that Pathname#pathmap exists. However, it was removed by #130

It would be easy enough to fix the docs. But perhaps a different question is, why was this removed from Pathname?

I expected the following to work, but instead got NoMethodError: undefined method 'pathmap' for #<Pathname

array_of_pathnames.each do |p|
  directory p.pathmap('%d')
end

Surely it's easy enough to use directory p.dirname. However, I have a lambda that is also used as a rule dep (to ensure the parent directories are created). I was hoping to use the same lambda when iterating over the array_of_pathnames.

dirname = ->(f) { f.pathmap('%d') }

pathnames.map(&dirname).map(&method(:directory))

rule %r{pattern} => dirname do |t|
  # stuff
end

As long as we're extending String, I'd expect the same extensions to work on the "more domain appropriate" Pathname.

@hsbt
Copy link
Member

hsbt commented Jul 6, 2021

I'm not sure why it's still exists. It was removed from the current top page that is https://ruby.github.io/rake/index.html .

@dsisnero
Copy link

dsisnero commented Nov 3, 2021

restore pathmap extension please. At least have it available to load 'require "rake/ext/pathmap"

@jasonkarns
Copy link
Contributor Author

@hsbt Is there any discussion thread on why the pathmap extension was removed from Pathname?

I could understand if the eventual goal is to remove it from String as well. Though as long as String has it, I'd expect Pathname to have it as well? If the eventual goal is to remove the extensions entirely (or perhaps make them opt-in?) should it be removed from both String and Pathname at the same time so the interfaces remain consistent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants