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

Documenting `Data` classes

未关闭
#1,375 0 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@tompng 已经在做这个了。

开始于 2026年7月23日。

  • #1754 来自 @tompng —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
ruby
领域
documentation

调研方向

首先使用 rdoc 复现文档中的示例,分别测试使用和不使用 Prism 解析器的情况,涵盖 Data.define、Struct.new 以及重新打开生成的类。跟踪这些定义的分类方式,并验证该类及其方法会作为类记录在文档中,同时不会保留过时的 Object 文档。

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

描述

Feature Request

rdoc does not usefully document data classes defined the correct way:

# Documenting a class made with Data.define
MyDataClass = Data.define :a do
  # Capitalize the value of +a+.
  def cap
    a.capitalize
  end
end

This documents a constant on Object, Object::MyDataClass instead of documenting it as a class itself, and the method within the data class definition is not documented either. It does not matter whether the Prism parser is used.

When documented with reopening, there are two different issues

MyDataClass = Data.define :a # :nodoc:

# Documenting a class made with Data.define
class MyDataClass
  # Capitalize the value of +a+.
  def cap
    a.capitalize
  end
end

If defined without # :nodoc:, MyDataClass is still documented as a constant on Object; if defined with # :nodoc:, the documentation is removed, but the generated documentation pages for Object isn't removed.

I believe that Data.define and Struct.new should be treated as if they were written as class variants.

主要语言
Ruby
星标
929
派生
469
平均合并
1 天 2 小时
30 天内合并 PR
19

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

ruby/rdoc 的其他 Issue

查看 ruby/rdoc 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

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