How do I drop to the IRB prompt from a running script?

后端 未结 6 617
再見小時候
再見小時候 2020-12-23 14:19

Can I drop to an IRB prompt from a running Ruby script?

I want to run a script, but then have it give me an IRB prompt at a point in the program with the current sta

6条回答
  •  北海茫月
    2020-12-23 14:22

    Just add this line to where you want the breakpoint:

    require 'ruby-debug';debugger

    but i suggest use pry instead of irb, which is super handy, insert the following line instead:

    require 'pry'; binding.pry

提交回复
热议问题