dexc¶ ↑
About¶ ↑
Automatically start the REPL and show trace on an exception to debug.
Requirements¶ ↑
-
Ruby 2.0.0 or later
-
Pry(optional)
Installation¶ ↑
$ gem install dexc
Examples¶ ↑
$ cat t.rb def m(obj) obj.to_s + 1 end m(0) $ ruby -rdexc t.rb 0:lib/dexc.rb:82> tp.enable TracePoint#enable: false 1:lib/dexc.rb:83> end Dexc#start: false 2:lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45> return gem_original_require(path) Kernel#gem_original_require: true 3:lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45> return gem_original_require(path) Kernel#require: true 4:t.rb:0> IO#set_encoding: #<File:t.rb (closed)> 5:t.rb:0> IO#set_encoding: #<File:t.rb (closed)> 6:t.rb:1> def m(obj) Module#method_added: nil 7:t.rb:2> obj.to_s + 1 Fixnum#to_s: "0" 8:t.rb:2> obj.to_s + 1 Exception#initialize: #<TypeError: no implicit conversion of Fixnum into String> 9:t.rb:2> obj.to_s + 1 Class#new: #<TypeError: no implicit conversion of Fixnum into String> 10:t.rb:2> obj.to_s + 1 Exception#exception: #<TypeError: no implicit conversion of Fixnum into String> 11:t.rb:2> obj.to_s + 1 Exception#backtrace: nil TypeError: no implicit conversion of Fixnum into String from t.rb:2:in `+' from t.rb:2:in `m' from t.rb:4:in `<main>' From: t.rb @ line 2 Object#m: 1: def m(obj) => 2: obj.to_s + 1 3: end [1] pry(main)> obj => 0 [2] pry(main)> hist[7] # or dexc_hist[7] => "0"