Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to quit pry loop without quiting rails console

Sometimes I'm stuck in a long loop when using binding.pry. I can quit the loop by exit-program, but the command exit rails console also.

Is there easy way to exit a long loop without quitting rails console?

like image 623
ironsand Avatar asked Feb 20 '16 04:02

ironsand


1 Answers

I'm not sure this is what you're looking for but you may want to try the disable-pry command which will automatically iterate though your entire loop without exiting the session. Another option (albeit not great for long loops) would be to use exit or Ctrl+D which iterates through a single cycle of a loop. You would have to enter it repeatedly until your loop was complete, however it would allow you to hit another breakpoint if that's your goal.

For a little more control you may want to add another gem like byebug or pry-byebug.

like image 176
Dom Avatar answered Oct 02 '22 16:10

Dom