6 ms·
In pry is it possible to return something when I exit the REPL? Like this: def do_something return binding.pry do_something_but_does_not_work end
by gcao 12y ago
In pry is it possible to return something when I exit the REPL? Like this:
def do_something
return binding.pry
do_something_but_does_not_work
end
result = do_something
process result
It might be very convenient if I put 'return binging.pry' just before the broken code. I can interactively fix the broken code and continue run outside of current method.
- vidarh 12y agoIf you are explicit: "return" in a Pry session will exit pry and return the value you pass to it, just as if you are in the method itself. So e.g. "return 42" would return 42 from do_something.