From: Ilan Berci Date: 2007-03-30T00:34:41+09:00 Subject: Re: Newbie question about dynamic class overriding Emil wrote: > > def sign_with_CA_two > class WIN32OLE > alias oldSend(str) Send(str) > def Send(str) > oldSend(str) > sleep 0.1 > end > end > @auto.Send("{a}") > @auto.Send("{b}") > @auto.Send("{1}") > @auto.Send("{2}") > end > Emil, While I am not certain, it seems like a singleton method may be the approach you are looking for: irb(main):001:0> class A irb(main):002:1> def send; "send"; end irb(main):003:1> end => nil irb(main):004:0> a = A.new => # irb(main):005:0> def a.send; super + '_version2' ; end => nil irb(main):006:0> a.send => "send_version2" irb(main):007:0> A.new.send => "send" just define a singleton method in the instance that you want to have alternate behavior.. If you really need the inheritance case, then you can use the following: irb(main):008:0> class B < A irb(main):009:1> def send; super + '_versionB'; end irb(main):010:1> end => nil irb(main):011:0> B.new.send => "send_versionB" hope this helps -- Posted via http://www.ruby-forum.com/.