Skip to content

Conversation

@adam12
Copy link
Contributor

@adam12 adam12 commented Nov 27, 2025

Add the ability to look up documentation for global variables (e.g., $<, $LOAD_PATH) and predefined constants (e.g., STDIN, ARGV, RUBY_VERSION) directly through the ri command. Documentation is extracted from the globals.rdoc page in the system store.

Changes:

  • Add display_global method to look up and display global documentation
  • Add extract_global_section to parse hierarchical headings in globals.rdoc
  • Add predefined_global_constant? to identify STDIN, ARGV, RUBY_* etc.
  • Update display_name to handle $-prefixed names and predefined constants
  • Update expand_name to skip expansion for globals
  • Fix nil matches bug in error handling when unknown globals are queried
  • Update help text with examples for global variable lookups

Add the ability to look up documentation for global variables (e.g., $<,
$LOAD_PATH) and predefined constants (e.g., STDIN, ARGV, RUBY_VERSION)
directly through the ri command. Documentation is extracted from the
globals.rdoc page in the system store.

Changes:
- Add display_global method to look up and display global documentation
- Add extract_global_section to parse hierarchical headings in globals.rdoc
- Add predefined_global_constant? to identify STDIN, ARGV, RUBY_* etc.
- Update display_name to handle $-prefixed names and predefined constants
- Update expand_name to skip expansion for globals
- Fix nil matches bug in error handling when unknown globals are queried
- Update help text with examples for global variable lookups
@adam12 adam12 temporarily deployed to fork-preview-protection November 27, 2025 18:48 — with GitHub Actions Inactive
@adam12
Copy link
Contributor Author

adam12 commented Nov 27, 2025

Parsing globals is less than ideal but I am not sure of a better approach. I'd love to see some support for keywords too but the same trick won't work (AFAICT).

@matzbot
Copy link
Collaborator

matzbot commented Nov 30, 2025

🚀 Preview deployment available at: https://034ce9e8.rdoc-6cd.pages.dev (commit: 6c00877)

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.

3 participants