From: Sean O'Dell Date: 2002-04-17T10:04:22+09:00 Subject: Redefining module methods In two Ruby script files I have two methods of the same name within a single module namespace. When the second file is "require'd", I would like to be able to save a pointer to the existing method, then allow the second method of the same name to override, such that both the overriding method can be called (normally) and the overridden method can be called via its pointer. 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() ....which I thought would call both methods one at a time. However, when I fiddle around with this code, generally speaking, either I get error messages saying undef_method is private or a warning that Module::testmethod is being overriden. I want to avoid the warning as well; whatever it takes to make Ruby happy with what I'm trying to do. Where am I messing this up? Sean