Provide easy way to open associated RDoc?

Open
#996 2 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
ruby

Research direction

Start by examining IRB's handling of commands and Ruby's method/source-location behavior, using the SecureRandom.method(:base64).rdoc_url example and comparing it with ri SecureRandom.base64. Done should define and implement a way to open core or stdlib RDoc from IRB, while deciding how third-party classes and modules are handled.

Written by the indexing model from the issue text.

Description

enhancement

This issue is based on a Mastodon thread here:

https://ruby.social/@getajobmike/113047521307357054

Today it is really difficult to find the documentation for most Ruby methods. There are old sites like apidock.com which still rank high. Ruby's dynamic typing makes it difficult to find the root location for a method. Even a tool like ri fails:

> ri SecureRandom.base64
Nothing known about SecureRandom.base64

I'd like to see a way for the user to open a corelib or stdlib method's rdoc from irb, for example:

open SecureRandom.method(:base64).rdoc_url

and this could open:

https://docs.ruby-lang.org/en/master/Random/Formatter.html#method-i-base64

One issue I can envision: what about other classes/modules for 3rd party code?

You could use a simple heuristic based on the source location to determine if this is a core code or not, e.g. "/Users/mperham/.rubies/ruby-3.3.3/lib/ruby/3.3.0/random/formatter.rb". If core, you can direct to "docs.r-l.org/$lang/$ver/...", a gem might go to "docs.rubygems.org/$gemname/$gemver/...".

What do you think? How else can we improve RDoc accessibility?

Dominant language
Ruby
Stars
477
Forks
165
Avg merge
1d 19h
Merged PRs (30d)
5

Getting set up

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.

More from ruby/irb

All issues in ruby/irb

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.