Catch method calls

Hi all,

We were wondering if it’s possible to catch all method calls. I mean a
kind
of ‘hook’ that allow you to do something just before a method is
executed.

Browsing in the mailing list’s archives, we read this thread about this
topic: http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/668.
Anyway,
this thread is pretty old, so we’d like to know if nowadays exists a
mechanism to do that.

Thank you all in advance!

This is a good read, if you want to implement such wrapper.
It’s not old… :slight_smile:

http://tinyurl.com/93yy9

gegroet,
Erik V.

Check out Kernel#set_trace_func. Note it is very slow!

Kent.