ruby / ruby/rbs

Should gems include private methods and constants in their RBS files?

Open
#1,461 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.2k
Forks
256
Avg merge
6d 17h
Merged PRs (30d)
37

Description

For Ruby gems, is it good practice to include all API (public, protected, and private) in their RBS files, or should they only include the publicly accessible API?

I work with the https://github.com/DataDog/dd-trace-rb gem, and we use https://github.com/soutaro/steep for type checking, thus private methods in the RBS API are relevant for our type checking. But for downstream consumers of the gem, they do not need information about private APIs, as they are not accessible to them.

Is there a guidance today on this subject for Ruby gems?
Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the question about RBS files for Ruby gems and the cited Steep use case. Compare how public, protected, and private methods and constants affect gem authors and downstream consumers, then document guidance that addresses both perspectives. Done means the project has a clear recommendation for what gem RBS files should include.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
documentation, tooling
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.