【问题标题】:binding.pry being skipped in Rubybinding.pry 在 Ruby 中被跳过
【发布时间】:2014-12-29 17:55:49
【问题描述】:

binding.pry 在某些情况下无法吸引我。

例如,当我在终端中使用ruby programtorun.rb 运行此代码时,它不会打开 Pry 会话。

require 'pry'

class Foo
  def bar
    boo = true
    binding.pry
  end
end

f = Foo.new
f.bar

我尝试重新安装 Pry,但问题仍然存在。

【问题讨论】:

    标签: ruby binding pry


    【解决方案1】:

    问题是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 为我停下来。

    【讨论】:

      猜你喜欢
      • 2016-06-04
      • 2020-06-15
      • 1970-01-01
      • 1970-01-01
      • 2013-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多