Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there the equivalent of next in Pry?

Tags:

ruby

pry

I don't see a way of just going to the next line when using pry as a debugger. All I can find is to edit the method and move binding.pry to the next line. Is there such a feature?

22:     def scan path
23:         @last_line_had_text, @files_read, @hands_read = nil, 0, 0
24:         Find.find(path){ |file_name|
=> 25:          binding.pry
26:             read_file(file_name) if file_name.include?(".txt")
27:         }
28:     end
like image 526
Jeremy Smith Avatar asked Oct 19 '11 21:10

Jeremy Smith


People also ask

How do I debug with pry?

Invoking pry debugging To invoke the debugger, place binding. pry somewhere in your code. When the Ruby interpreter hits that code, execution stops, and you can type in commands to debug the state of the program.

How does pry work?

Pry is like IRB on steroids Both IRB and Pry use REPL commands: Read, Evaluate, Print, and Loop. But Pry allows you to go further when debugging. For example, Pry gives you color-coded syntax, which helps when you're trying to figure out what will happen when code is executed.


3 Answers

Ctrl+D, you can jump to next break or exit

like image 94
mko Avatar answered Sep 20 '22 06:09

mko


Recommend to use pry-byebug if ruby version >2.0

like image 22
TheOneTeam Avatar answered Sep 20 '22 06:09

TheOneTeam


If you want (this and more) debugging features you'll need to use pry_debug: https://github.com/Mon-Ouie/pry_debug

like image 28
deviousdodo Avatar answered Sep 22 '22 06:09

deviousdodo