From: Sean O'Dell Date: 2002-04-17T11:24:26+09:00 Subject: Re: Redefining module methods wrote in message news:200204170122.g3H1MGM21634@sharui.nakada.kanuma.tochigi.jp... > Hi, > > At Wed, 17 Apr 2002 10:04:22 +0900, > Sean O'Dell wrote: > > Here's a snippet of code I can't get to work properly, but which I'm sure is > > close to what I want to do: > > > > def Module::testmethod() > > print("test 1\n") > > end > > > > methodptr = method(:testmethod) > > undef_method(:testmethod) > > > > def Module::testmethod() > > print("test 2\n") > > end > > > > testmethod() > > methodptr.call() > > Although I'm not sure what do you want exactly, how about this? > > def Module::testmethod() > print("test 1\n") > end > > methodptr = Module.method(:testmethod) > class << Module > undef_method(:testmethod) > end > > def Module::testmethod() > print("test 2\n") > end > > Module.testmethod() > methodptr.call() It worked as good as some of my other efforts...it works, but it still says Module:testmethod is being redefined. Hmm. Sean