How to debug ruby code?

后端 未结 9 2180
伪装坚强ぢ
伪装坚强ぢ 2020-12-28 15:04

I run Ubuntu 10.10. I just want to debug a simple script. After spending half a day trying to figure out how that could be done I give up. What the heck am I supposed to do?

9条回答
  •  天涯浪人
    2020-12-28 16:02

    1. In Ruby:

      ruby -rdebug myscript.rb then,

      • b : put break-point
      • and n(ext) or s(tep) and c(ontinue)
      • p(uts) for display
    2. In Rails: Launch the server with

      • script/server --debugger

        and add debugger in the code.

提交回复
热议问题