Comments on: Temporary overwrite method for specific task Blogs and Ramblings of the openSUSE Members Fri, 06 Mar 2020 17:50:09 +0000 hourly 1 By: Josef Reidinger Fri, 18 Mar 2011 16:01:07 +0000 Yes, looks similar. Of course you have advantage that you edit just one object, so your solution is multithread. My change affect all threads. Remove_method versus undef_method depends on your goal. Just one note to your solution.
Remove :wait_for_message and then realias it is useles. You can just call alias and if you want cleaning, you can remove orig version ( or there is sufficient just undef ).

By: Martin Vidner Fri, 18 Mar 2011 13:13:03 +0000 I did something almost identical:

The difference is that I needed to patch a single object, so I used class << @obj, def, alias, remove_method.

Hmm, this is significant if T#m exists in a superclass: