Merge extensions under `EXTEND_COMMANDS` into `Context` class

Open
#563 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
ruby
Domain
cli

Research direction

Inspect EXTEND_COMMANDS in lib/irb/extend-command.rb and the calls made from Context#initialize in context.rb. Use the extension pattern in lib/irb/ext/history.rb as an example of the complexity to remove. Done means selected extensions are merged into Context while preserving their behavior and eliminating the unnecessary extension hacks.

Written by the indexing model from the issue text.

Description

There are a few features defined as extensions:

https://github.com/ruby/irb/blob/0e862c5751968c589904ed93c3d707d919390597/lib/irb/extend-command.rb#L314-L319

The intention was that those files will be lazily-loaded until the related methods are called. But if we look at context.rb, we can see that all of the methods are called in Context#initialize. So none of them are lazily loaded anymore.

Consider this lazy-loading mechanism + individual extensions' hacks to extend Context introduces unnecessary complexity to IRB (example), I think we should start merging them one by one.

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.