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

后端 未结 6 616
再見小時候
再見小時候 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:32

    you can use ruby-debug to get access to irb

    require 'rubygems'
    require 'ruby-debug'
    x = 23
    puts "welcome"
    debugger
    puts "end"
    

    when program reaches debugger you will get access to irb.

提交回复
热议问题