From: dblack@... Date: 2002-08-08T12:27:21+09:00 Subject: Re: Redefining send() Hi -- On Thu, 8 Aug 2002, Harry Ohlsen wrote: > My code looked like ... > > class Fred > alias old_send send > > def send(name, *args) > $stderr.puts "send('#{name}')" > old_send(name, *args) > end > > # ... > end > > Hence, I was expecting that when any method of Fred was called, I'd see the > message, and then the real code would be called. As I say, I never see the > message, so I assume the re-definition has been ignored ... or maybe I'm > missing the point entirely! I can't get it not to work: class Fred alias old_send send def send(name, *args) $stderr.puts "send('#{name}')" old_send(name, *args) end def say(x) puts "hi: #{x}" end end Fred.new.send(:say, "there") Output: send('say') hi: there (Ruby 1.6.7) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav