From: James Edward Gray II Date: 2007-04-06T01:01:19+09:00 Subject: Re: Redefining initialize while staying -w clean On Apr 5, 2007, at 10:55 AM, Daniel Berger wrote: > On Apr 5, 9:47 am, Andrew Johnson wrote: >> Daniel Berger wrote: >>> Hi all, >> >>> Is it possible to redefine initialize and stay -w clean? In win32- >>> file- >>> stat, I've redefined initialize to suit my needs for MS Windows. >> >>> If I do "undef_method(:initialize)" and run with -w, I'll get: >> >>> "warning: undefining `initialize' may cause serious problem". >> >>> However, if don't do that, I get "warning: method redefined; >>> discarding old initialize". >> >> Try aliasing the method before redefining it: >> >> alias :old_init :initialize >> def initialize() end > > That doesn't appear to work. Do you have a code snippet where it does > work? Perhaps I've missed something. Remove the colons or swap alias with alias_method and add a comma. James Edward Gray II