当我得到异常时,通常是在调用堆栈的深处。发生这种情况时,我通常隐藏了真正令人讨厌的代码行:
tmp.rb:7:in `t': undefined method `bar' for nil:NilClass (NoMethodError)
from tmp.rb:10:in `s'
from tmp.rb:13:in `r'
from tmp.rb:16:in `q'
from tmp.rb:19:in `p'
from tmp.rb:22:in `o'
from tmp.rb:25:in `n'
from tmp.rb:28:in `m'
from tmp.rb:31:in `l'
... 8 levels...
from tmp.rb:58:in `c'
from tmp.rb:61:in `b'
from tmp.rb:64:in `a'
from tmp.rb:67
“ ... 8个级别...”的截断给我带来了很多麻烦。我对此没有太大的成功:我如何告诉ruby我希望转储包括整个堆栈?