`chws` w/o argument does not change current workspace to main
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in lib/irb/ext/change-ws.rb at IRB::Context#change_workspace and review how home_workspace is saved when chws is called with and without an argument. Reproduce the documented sequence with chws Object.new followed by chws. Done means the no-argument command returns to the original main workspace, as described in doc/irb/irb.rd.ja.
Written by the indexing model from the issue text.
Description
The document (doc/irb/irb.rd.ja) says chws or irb_change_workspace command with no arguments changes the current workspace to the home workspace (i.e. the main object assigned to self when IRB begins). This does not happen in some cases.
Using irb 1.1.0.pre.2 with MRI master (d806078237).
The following example illustrates the problem -- the second invocation of chws, without an argument, is expected to change the workspace back to main. Actually, the workspace is not changed.
irb(main):001:0> chws Object.new
=> #<Object:0x000055c15c4919e8>
irb(#<Object:0x000055c15c4919e8>):002:0> chws
=> #<Object:0x000055c15c4919e8>
irb(#<Object:0x000055c15c4919e8>):003:0>
The cause of the problem seems to be IRB::Context#change_workspace at lib/irb/ext/change-ws.rb#L32, which saves the @home_workspace (via #home_workspace) only when it is first called without arguments, while it should do so before changing the workspace.
- Dominant language
- Ruby
- Stars
- 478
- Forks
- 158
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 12
Contributor 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 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Proposal: public hook for external documentation providers in show_doc and the completion doc dialog Open
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bensheldon/good_job#1816 · 5 comments ·