1
79
你可以使用 Kernel.caller 为此。为异常生成堆栈跟踪时使用相同的方法。 来自文档:
|
2
29
尝试
|
3
12
尝试 error.backtrace :
生产:
|
4
7
对于Ruby 2.0+,您可以使用
从 the docs :
使用实例:
|
5
3
这将为您提供一个数组,其中包含任何正常回溯中可能得到的所有行。 |
6
2
如果你想的话,你也可以自己创造。如中所示 雄辩红宝石 Russ Olsen:
|