ruby / ruby/irb

Add a command to peek at otherwise inaccessible context

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

Nobody has claimed this yet.

Dominant language
Ruby
Stars
478
Forks
158
Avg merge
1d 12h
Merged PRs (30d)
12

Description

Sometimes we run into inaccessible context when debugging, such as anonymous arguments: *, **, &, ..., or arguments that conflict with Ruby keywords, such as class, end, if.

In these situations, it would be useful to be able to peek at the context. Maybe there’s a better name for this concept, but essentially it would be an IRB command that just returns *args, **kwargs, and &block.

def peek(*args, **kwargs, &block)
  { args:, kwargs:, block: }
end

This would support things like:

peek(*)
peek(**)
peek(&)
peek(...)
peek(class:, end:, if:)

Does this sound useful to anyone else?

Contributor guide

Open the contributing guide

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.

Research direction

Start by locating how IRB commands are defined and how method arguments are evaluated in the interactive Ruby session. Compare the proposed peek behavior for *, **, &, ..., and keyword-conflicting names, then determine a command name and interface. Done means the command can expose these otherwise inaccessible values with documented behavior and tests for the examples in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.