如何调试Ruby脚本 [英] How to debug Ruby scripts
本文介绍了如何调试Ruby脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从互联网上复制了以下Ruby代码并进行了一些更改,但是没有用。
I copied the following Ruby code from the Internet and made a few changes but it doesn't work.
我该怎么做才能自己调试程序?
What can I do to debug the program by myself?
推荐答案
通过以下方式安装:
$ gem install pry
$ pry
然后添加:
require 'pry'; binding.pry
进入您的程序。
从撬
0.12.2开始,没有导航命令,例如 next
, break
等。其他一些宝石也提供了此功能,例如,参见 pry-byedebug
。
As of pry
0.12.2 however, there are no navigation commands such as next
, break
, etc. Some other gems additionally provide this, see for example pry-byedebug
.
这篇关于如何调试Ruby脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文