Skip to content

Instantly share code, notes, and snippets.

@k-tsj
Last active July 2, 2017 03:08
Show Gist options
  • Save k-tsj/7be6c6d67fb5be28f777735e8879cd50 to your computer and use it in GitHub Desktop.
Save k-tsj/7be6c6d67fb5be28f777735e8879cd50 to your computer and use it in GitHub Desktop.
$ ruby t.rb
["t.rb:1:in `m1'", "t.rb:7:in `<main>'"]
["t.rb:2:in `m2'", "t.rb:8:in `<main>'"]
["t.rb:9:in `<main>'"]
["t.rb:4:in `block in <main>'", "t.rb:10:in `<main>'"]
def m1; end
def m2; raise ''; end
define_method(:bm1) {}
define_method(:bm2) { raise '' }
TracePoint.trace(:return) { p caller_locations }
m1
m2 rescue nil
bm1
bm2 rescue nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment