在某些情况下,binding.pry并不适合我。
例如,当我在终端中使用ruby programtorun.rb运行此代码时,它不会打开一个撬动会话。
require 'pry'
class Foo
def bar
boo = true
binding.pry
end
end
f = Foo.new
f.bar我尝试重新安装Pry,但问题仍然存在。
发布于 2014-12-30 02:27:17
问题是binding.pry会在程序中要执行的下一行停止。你的下一行是不存在的。从字面上讲,binding.pry是您在脚本结束之前最后调用的东西。
改变
class Foo
def bar
boo = true
binding.pry
end
end至
class Foo
def bar
binding.pry
boo = true
end
end让我在boo=true停了下来。
https://stackoverflow.com/questions/27693708
复制相似问题