Comments on: Temporary overwrite method for specific task https://lizards.opensuse.org/2011/03/18/temporary-overwrite-method-for-specific-task/ Blogs and Ramblings of the openSUSE Members Fri, 06 Mar 2020 17:50:09 +0000 hourly 1 https://wordpress.org/?v=4.7.5 By: Josef Reidinger https://lizards.opensuse.org/2011/03/18/temporary-overwrite-method-for-specific-task/#comment-5058 Fri, 18 Mar 2011 16:01:07 +0000 http://lizards.opensuse.org/?p=6810#comment-5058 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 https://lizards.opensuse.org/2011/03/18/temporary-overwrite-method-for-specific-task/#comment-5056 Fri, 18 Mar 2011 13:13:03 +0000 http://lizards.opensuse.org/?p=6810#comment-5056 I did something almost identical: https://github.com/mvidner/ruby-dbus/blob/9384f5e4284bb3bff722eeebe28c7d160173e781/test/t6-loop.rb#L22

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: http://www.nach-vorne.de/2008/2/28/undef_method-remove_method/index.html

]]>