Allow inspecting implicit parameters via `implicit_parameter_get` etc.
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start by reading Ruby 4.0's implicit-parameter interrogation methods referenced in the linked Ruby issue and the binding.irb behavior shown in the example. Trace how IRB evaluates names such as it and _1, then verify that implicit_parameter_get and related methods can inspect them from the session without rewriting the block.
Written by the indexing model from the issue text.
Description
Currently, it is not possible to know what implicit parameters like it/_1 actually are. If I want to know, I have to rewrite the block to take explicit parameters.
[1, 2, 3].each do
puts it
binding.irb
end
$ ruby test.rb
1
From: test.rb @ line 3 :
1: [1, 2, 3].each do
2: puts it
=> 3: binding.irb
4: end
irb(main):001> it
/home/user/code/test/test.rb(irb):1:in 'block in <main>': undefined local variable or method 'it' for main (NameError)
from test.rb:3:in 'Binding#irb'
from test.rb:3:in 'block in <main>'
from test.rb:1:in 'Array#each'
from test.rb:1:in '<main>'
Ruby 4.0 actually added methods to interogate the values of such params (https://bugs.ruby-lang.org/issues/21049#note-7) and it would be great if it can just work in irb.
- Dominant language
- Ruby
- Stars
- 477
- Forks
- 165
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby/irb
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
Maintainers usually reply within 2 days
-
Proposal: public hook for external documentation providers in show_doc and the completion doc dialogPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 5/5 Over a week Newbie friendliness 38/100
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
Similar issues
-
needs verification
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 13 days
-
🐛 bug 👩💻 équipe CE 🧑🏭 entreprises
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
betagouv/conseillers-entreprises#4808 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
yosiat/panko_serializer#250 ·