Skip to content

Add signatures for Gem::Package::TarReader - #3214

Merged
ksss merged 1 commit into
ruby:masterfrom
ksss:gem-package-tar-reader
Oct 10, 2026
Merged

ksss merged 1 commit into
ruby:masterfrom
ksss:gem-package-tar-reader

Conversation

@ksss

@ksss ksss commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Add minimal signatures for Gem::Package::TarReader and the classes it depends on, so that code using them can be type checked without unknown constant errors.

  • Gem::Package
  • Gem::Package::TarHeader (initialize)
  • Gem::Package::TarReader (self.new, which accepts a block)
  • Gem::Package::TarReader::Entry (initialize)

Why core and why minimal

Gem::Package is not loaded by default (require "rubygems/package" is needed), so strictly speaking it could belong to stdlib like random-formatter. However, out of 240 files under lib/rubygems (Ruby 4.0.6), only 19 are loaded at startup and 12 more are registered as autoload. Splitting every non-loaded part of RubyGems into stdlib libraries would be too fine-grained.

So this PR follows the existing convention for non-loaded RubyGems classes such as Gem::Uninstaller, Gem::DependencyInstaller, and Gem::StreamUI:

  • Classes loaded at startup or via autoload can have full signatures in core.
  • Classes that require an explicit require get only minimal declarations (class declarations and constructors) in core, since core signatures are loaded every time.

Methods can be added later when needed.

Docs were annotated with RDoc generated from Ruby 4.0.6's lib/rubygems.

🤖 Generated with Claude Code

@ksss
ksss force-pushed the gem-package-tar-reader branch from dc36b64 to c59f2e9 Compare October 9, 2026 09:35
Add minimal declarations for Gem::Package, Gem::Package::TarHeader,
Gem::Package::TarReader, and Gem::Package::TarReader::Entry so that
code using them does not hit unknown constant errors.

Since core is loaded every time, only class declarations and
constructors are included, like Gem::Uninstaller and
Gem::DependencyInstaller. Methods can be added later when needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ksss
ksss force-pushed the gem-package-tar-reader branch from 6905516 to 16344c4 Compare October 10, 2026 06:56
@ksss
ksss added this pull request to the merge queue Oct 10, 2026
Merged via the queue into ruby:master with commit 9b21870 Oct 10, 2026
25 checks passed
@ksss
ksss deleted the gem-package-tar-reader branch October 10, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant