如何调试 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.
如何自己调试程序?
推荐答案
Use Pry (Pryhttps://github.com/pry/pry" rel="nofollow noreferrer">GitHub).
Use Pry (GitHub).
安装方式:
$ gem install pry
$ pry
然后添加:
require 'pry'; binding.pry
进入你的程序.
然而,从 pry
0.12.2 开始,没有诸如 next
、break
等导航命令.其他一些 gem 还提供例如,请参见 pry-byebug
.
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-byebug
.
这篇关于如何调试 Ruby 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文