From: "zimbatm ..." Date: 2009-06-10T06:17:49+09:00 Subject: Re: monkeypatch-0.1.2 (alpha) :: News from the front :: One aspect where I agree with Thomas Sawyer is that the API should be minimalized. Even I, don't like to learn new things if they aren't funny (and this project is useful but not really exciting). By skimming the existing patches on github, I saw, oh horror, that I completely ignored the common extension case: +++++++++++++++++ module MyStringExtension def to_moo "moo!" end end class String include MyStringExtension end # or String.send(:include, MyStringExtension) --------------------- This is why the next version (not even on github yet) will use a dramatically different API. Not everything is fixed yet, but it should look like this: ++++++++++++++++++ module MyStringExtension extend MonkeyPatch def to_moo "moo!" end end class String include MyStringExtension end ----------------------- Pretty close isn't it ? This is the simple case where you just want to add methods to an external class. If you start to redefine, alias or remove methods, it's a bit more complicated. But just like this, you get the same as before, with the added assurance that is will not override another #to_moo method. Cheers, zimbatm -- Posted via http://www.ruby-forum.com/.