From: Iain Barnett Date: 2012-06-20T02:34:30+09:00 Subject: Looking for a better way to add a method to a core class than monkey patching Hi all, I'd like to add a method to the String class for a gem I'm making. Obviously, I could just open it up and pop the method in, but I'd like to know what is the state-of-the-art for adding a method. Do I get anything better from putting the method in a module and then opening up the class and including it? I can't see why but I'd like to know. I don't wish to use a new class that inherits from String because I understand that there's a gotcha with String due to something done for performance reasons (though I can't remember the exact details I remember the warning!), and there's obvious good sides to the method being directly in String that far outweigh the inheritance angle. Any thoughts or suggestions would be appreciated. Regards, Iain