ruby 在 Pry 中是否有相当于 next 的东西?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7828569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there the equivalent of next in Pry?
提问by Jeremy Smith
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?
当使用 pry 作为调试器时,我没有看到直接转到下一行的方法。我能找到的只是编辑方法并将 binding.pry 移动到下一行。有这样的功能吗?
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
采纳答案by deviousdodo
If you want (this and more) debugging features you'll need to use pry_debug: https://github.com/Mon-Ouie/pry_debug
如果你想要(这个和更多)调试功能,你需要使用pry_debug:https: //github.com/Mon-Ouie/pry_debug
回答by mko
Ctrl+D, you can jump to next break or exit
Ctrl+D,可以跳到下一个休息点或退出
回答by Kit Ho
Recommend to use pry-byebugif ruby version >2.0
pry-byebug如果 ruby 版本 >2.0推荐使用
回答by horseyguy
You can also use ruby-debug_prywhich integrates pry as a ruby-debugcommand, enabling you to easily switch back and forth between the two.
您还可以使用ruby-debug_pry,它将pry集成为一个ruby-debug命令,使您能够轻松地在两者之间来回切换。
A new project called pry-navis now the recommended way to do this.
现在推荐使用一个名为pry-nav 的新项目来执行此操作。
回答by nmott
If using Using MRI 1.9.2+ then there is a new project, pry-debugger, that is now the recommended replacement for pry-nav. It's by the same author as pry-nav and is faster.
如果使用 Using MRI 1.9.2+ 那么有一个新项目 pry -debugger,它现在是 pry -nav 的推荐替代品。它与 pry-nav 是同一作者,而且速度更快。

