Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Pathname#pathmap is still (erronously) documented

未关闭
#348 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
技术栈
ruby
领域
build-system

调研方向

从链接的 Pathname 文档开始,并查看 issue #130,以了解为什么移除了 Pathname#pathmap。根据当前 API 检查报告中的 Ruby 示例,然后确定文档是否只应删除该方法,还是还应说明受支持的替代方案。完成标准是文档准确反映可用的 Pathname 方法,并且范围问题已解决。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Ruby
星标
2.5k
派生
650
平均合并
6 分钟
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby/rake 的其他 Issue

查看 ruby/rake 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。