Skip to content

Fix CGI::Util method definition locations in core.rbs - #1060

Merged
github-actions[bot] merged 5 commits into
ruby:mainfrom
ksss:cgi
Aug 2, 2026
Merged

Fix CGI::Util method definition locations in core.rbs#1060
github-actions[bot] merged 5 commits into
ruby:mainfrom
ksss:cgi

Conversation

@ksss

@ksss ksss commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

gems/cgi/0.5/core.rbs incorrectly places several escape-related methods and a constant under CGI::Util. Checking against the actual cgi gem source (0.5.2) shows CGI::Util only defines pretty and rfc1123_date; everything else lives in CGI::Escape (with CGI::EscapeExt providing an optional C-accelerated override for a subset of methods).

  • escape, unescape, escapeURIComponent, unescapeURIComponent, escapeHTML, unescapeHTML, escapeElement, unescapeElement, and TABLE_FOR_ESCAPE_HTML__ are defined in CGI::Escape (lib/cgi/escape.rb), not CGI::Util. CGI::EscapeExt is added as an empty module — it's an internal implementation detail whose public surface is already covered by CGI::Escape.
  • RFC822_DAYS and RFC822_MONTHS do not exist anywhere in the gem's source and are removed.
  • h, an alias for escapeHTML defined in lib/cgi/escape.rb, was missing from core.rbs and is added.

Verified method ownership directly against a locally installed cgi 0.5.2 via CGI.instance_method(:escape).owner etc., and cross-checked the C extension (ext/cgi/escape/escape.c) for what CGI::EscapeExt actually defines at runtime.

  • gems/cgi/_reviewers.yaml: adds ksss as a reviewer for the cgi gem.

Test plan

  • bin/test gems/cgi/0.5 passes (rbs validate + steep check) after each commit

ksss added 5 commits August 2, 2026 15:04
CGI::Util does not define these constants; they don't appear
anywhere in the cgi gem's source.
escape, unescape, escapeURIComponent, unescapeURIComponent,
escapeHTML, unescapeHTML, escapeElement, unescapeElement, and
TABLE_FOR_ESCAPE_HTML__ are actually defined in CGI::Escape
(lib/cgi/escape.rb), not CGI::Util. Add CGI::Escape and include/extend
it on CGI, and add an empty CGI::EscapeExt as a placeholder for the
internal C-accelerated implementation module.
lib/cgi/escape.rb defines `alias h escapeHTML`, but core.rbs was
missing this alias entirely.
These module-level descriptions were not verified against actual
rdoc output, so drop them rather than risk documentation that
doesn't match the real rdoc.
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

@ksss Thanks for your contribution!

Please follow the instructions below for each change.
See also: https://github.com/ruby/gem_rbs_collection/blob/main/docs/CONTRIBUTING.md

Available commands

You can use the following commands by commenting on this PR.

  • /merge: Merge this PR if CI passes

cgi

You changed RBS files for an existing gem.
This gem does not have reviewers. So you can merge this PR immediately if the CI passes.
We recommend you add yourself to the reviewers for this gem.

@ksss

ksss commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

/merge

@github-actions
github-actions Bot merged commit 8276242 into ruby:main Aug 2, 2026
6 checks passed
@ksss
ksss deleted the cgi branch August 2, 2026 06:23
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