Created
July 9, 2017 03:10
-
-
Save cjoudrey/2e2a9ecd1db4542a5440b8b0b892b56c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dog | |
def initialize; end | |
def bark; end | |
end | |
trace = TracePoint.new(:call, :return) do |tp| | |
p [tp.event, tp.defined_class, tp.method_id] | |
end | |
trace.enable do | |
buddy = Dog.new | |
buddy.bark | |
end | |
# [:call, Dog, :initialize] | |
# [:return, Dog, :initialize] | |
# [:call, Dog, :bark] | |
# [:return, Dog, :bark] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment