You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you use the multi-irb feature and don't want to see it deprecated from IRB, please leave a comment below to explain your use case of it. It will help us assess this plan.
Hi. I find irb command to be useful as an equivalent of pry cd.
For example when debugging session starts in irb console (like rails console - testing on staging case), not by putting binding.irb in the tested file.
bin/railsconsole# assume it's part of the applicationclassGreeterdefhello="Hello, World!"endg=Greeter.newirbg# <-----------------Multi-irbcommandsaredeprecated[...]irb#1(#<Greeter:0x00007faa7b850188>):001> hello=>"Hello, World!"
Ctrl-D to get back.
UPDATE: OK, just realized that it's exactly what chws is for 😉 Only more complex to remember the syntax:
Is there a way to go back without having first to push current workspace to the stack?
pry example:
[3] pry(main)> cd g
[4] pry(#<Greeter>):1> hello
# => "Hello, World!"
[5] pry(#<Greeter>):1> cd ..
[6] pry(main)>
My impression is that cd, cd .. is the human-friendly interface, while workspace commands are generally building blocks of it exposed to the user (missed one layer of abstraction).
I love how this got implemented.... Now whenever I try to assign to an instance variable with the name jobs it now prints a message and doesn't actually create the var... brilliant.
This implementation is a bit overly aggressive. As @jwkoelewijn points out, it breaks any code we might type or copy-paste that uses a jobs instance variable:
worker (local) > jobs = Job.all
Multi-irb commands are deprecated and will be removed in IRB 2.0.0. Please use workspace commands instead.
If you have any use case for multi-irb, please leave a comment at https://github.com/ruby/irb/issues/653
#0->irb on main (#<Thread:0x0000ffff8239a7b0 run>: running)
=> nil
worker (local) > jobs
Multi-irb commands are deprecated and will be removed in IRB 2.0.0. Please use workspace commands instead.
If you have any use case for multi-irb, please leave a comment at https://github.com/ruby/irb/issues/653
#0->irb on main (#<Thread:0x0000ffff8239a7b0 run>: running)
=> nil
Is there a way we can not break assignment to a variable named jobs?
Reacted by Chris Watkins, Serhii Bilyk, Roberto Rodriguez and Ellie P.
Something I miss without being able to just run irb everywhere is being able to inspect something that only exists for the duration of a block - eg:
irb(main):002:0> File.open("/etc/hosts") { |f| irb f }irb#1(#<File:0x000055be023ef240>):001:0> self.size=> 174
and then being able to iteratively experiment with methods on the object yielded to the block.
(pretending for the moment that File.open doesn't support a blockless variant)
Is there an equivalent version that works without multi-irb?
[EDIT: Oh, maybe I should just be using binding.irb ?
I'm getting this message when I do jobs = Job.find(job_ids) and never used to run into this problem..., am I not allowed to use jobs as a variable name? I've been doing that for 15 years lol.
irb(main):093> jobs = Job.find(job_ids)
Multi-irb commands are deprecated and will be removed in IRB 2.0.0. Please use workspace commands instead.
If you have any use case for multi-irb, please leave a comment at https://github.com/ruby/irb/issues/653
#0->irb on main (#<Thread:0x00007f26904fa9a8 run>: running)
=> nil
irb(main):094> js = Job.find(job_ids)
=>
[#<Job:0x00007f26887180d0
...
It's also eating the output somehow, and returning nil? I swear this never used to happen, what's going on here lol.
Activity
zenspider commentedon Jan 24, 2024
Please consider reusing the old command names.
chwsis just... not good.kml commentedon Feb 15, 2024
Hi. I find
irbcommand to be useful as an equivalent of pry cd.For example when debugging session starts in irb console (like rails console - testing on staging case), not by putting
binding.irbin the tested file.Ctrl-Dto get back.UPDATE: OK, just realized that it's
exactlywhatchwsis for 😉 Only more complex to remember the syntax:Is there a way to go back without having first to push current workspace to the stack?
pry example:
My impression is that
cd,cd ..is the human-friendly interface, while workspace commands are generally building blocks of it exposed to the user (missed one layer of abstraction).https://github.com/ruby/irb?tab=readme-ov-file#commands
st0012 commentedon Jun 16, 2024
@kml Thanks for the feedback 🙂 I'm adding a simpler
cdcommand in #971jwkoelewijn commentedon Jun 28, 2024
I love how this got implemented.... Now whenever I try to assign to an instance variable with the name
jobsit now prints a message and doesn't actually create the var... brilliant.ozydingo commentedon Jul 30, 2024
This implementation is a bit overly aggressive. As @jwkoelewijn points out, it breaks any code we might type or copy-paste that uses a
jobsinstance variable:Is there a way we can not break assignment to a variable named
jobs?tompng commentedon Aug 1, 2024
Usability problem of local variable and command is fixed in #961 and released
jwkoelewijn commentedon Aug 2, 2024
Sweet, thanks! 🙌🏼
jdelStrother commentedon Oct 22, 2024
Something I miss without being able to just run
irbeverywhere is being able to inspect something that only exists for the duration of a block - eg:and then being able to iteratively experiment with methods on the object yielded to the block.
(pretending for the moment that File.open doesn't support a blockless variant)
Is there an equivalent version that works without multi-irb?
[EDIT: Oh, maybe I should just be using
binding.irb?]
nzifnab commentedon Nov 19, 2024
I'm getting this message when I do
jobs = Job.find(job_ids)and never used to run into this problem..., am I not allowed to usejobsas a variable name? I've been doing that for 15 years lol.It's also eating the output somehow, and returning nil? I swear this never used to happen, what's going on here lol.
tompng commentedon Nov 20, 2024
The
jobs = valueproblem existed inirb-1.13.0throughirb-1.13.2and already fixed inirb >= 1.14.0