如果 Pry 遇到异常(例如,如果您只是将 undefined variable “x”放在脚本末尾),则会进入交互模式。
(此外,如果在脚本本身内,您需要“pry”
,并将 binding.pry
放在您想要进行交互的位置。)
但我想知道:当我在命令提示符下输入它时,是否可以将某种标志/选项/参数添加到 pry example.rb
命令中,这样它就会当执行任何 example.rb
脚本结束时,无论里面有什么,都进入交互状态吗? (当然,假设在结束之前没有异常(exception)。)
最佳答案
还没有,但请提交 issue我会添加它:)
关于 ruby , pry 开: Can I add something to the command `pry example.rb` so pry automatically goes interactive when it finishes executing the script?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16212147/