On 1/16/06, Jacob Fugal <lukfugl / gmail.com> wrote: > Try: > > class Object > alias_method :old_send, :send > def send meth, *args > STDERR.puts "#{ meth } was called" > old_send meth, *args > end > end > > The difference is the splat in front of args in the invocation of > old_send. With the splat there, it seems to work for me. > > irb> -1.send(:abs) > abs was called > => 1 > > This used to give me an error about wrong number of arguments. > > Note: this still doesn't work without invoking send explicitly, since > foo.bar is *actually* equivalent to foo.__send__(:bar), *not* > foo.send(:bar). It just so happens the the default implementation of > send just forwards to __send__. And overwriting __send__ is a *bad* > idea. :) Hm. Well, essentially what I want to do is output print statements every time I enter and leave a method. (having problems identifying what's going on in my code)