Ruby,pry:我可以在命令“ pry example.rb”中添加一些内容,以便pry在执行完脚本后自动进行交互吗? [英] Ruby, pry: Can I add something to the command `pry example.rb` so pry automatically goes interactive when it finishes executing the script?

查看:70
本文介绍了Ruby,pry:我可以在命令“ pry example.rb”中添加一些内容,以便pry在执行完脚本后自动进行交互吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果遇到异常(例如,如果您只是在脚本的末尾放置未定义的变量'x',则Pry进入交互模式)。

Pry goes into interactive mode if it encounters an exception (eg if you just put an undefined variable 'x' at the end of the script).

(也如果在脚本本身中,您要求撬 并将 binding.pry 放在要进行交互的位置

(Also if, inside the script itself you require 'pry' and put binding.pry at the point you want to go interactive at.)

但是我想知道:是否可以在 pry示例中添加某种标记/选项/参数呢? rb 命令在命令提示符下输入时,它会在执行 any example.rb 脚本,不管里面有什么? (当然,前提是 之前没有例外。)

But I'm wondering: Is there's some kind of flag/option/argument thingy that I can add to the pry example.rb command when I enter it at the command prompt, so it will go interactive when it reaches the end of executing any example.rb script, regardless of what's inside? (Assuming no exceptions before the end, of course.)

(这显然对与您使用的编辑器特别有用可以从类似Notepad ++的方式运行外部程序,请参见 this this 。)

推荐答案

还没有,但是请提交问题,我将其添加:)

Not yet, but file an issue and i'll add it :)

这篇关于Ruby,pry:我可以在命令“ pry example.rb”中添加一些内容,以便pry在执行完脚本后自动进行交互吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆