From: blogger Date: 2007-12-07T03:00:46+09:00 Subject: Preferred way to overwrite an object method? I have an app with source code I really don't want to touch, which has an object method I want to be able to overwrite in a certain task. (No need to restore the function.) My current technique is as follows: In the application: class C def m puts "barf" end end In my module file: module M def self.included(mod) mod.module_eval <<-EOF def m puts "c001c0de" end EOF end end In the rake file: C:send(:include, M) Now I REALLY don't like module_eval(string). Is there a preferred method to achieve this result?