Skip to content

Instantly share code, notes, and snippets.

@cjoudrey
Created July 9, 2017 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjoudrey/2e2a9ecd1db4542a5440b8b0b892b56c to your computer and use it in GitHub Desktop.
Save cjoudrey/2e2a9ecd1db4542a5440b8b0b892b56c to your computer and use it in GitHub Desktop.
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