How to debug ruby code?

后端 未结 9 2223
伪装坚强ぢ
伪装坚强ぢ 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 15:43

    Use IRB. It is an interactive Ruby shell. When errors occur, it gives a trace with line numbers so that you can tell what part of your code went wrong. You can load your source files and run individual methods to see if they are working properly. IRB provides useful output - when you enter some code, it will evaluate the expression and then print the return value using .inspect.

提交回复
热议问题