From: Brian Candler Date: 2003-02-28T21:49:41+09:00 Subject: Re: [ANN] RMagick 1.0.0 now available On Fri, Feb 28, 2003 at 09:42:17AM +0900, Tim Hunter wrote: > And, as a last resort, if you're writing an application and could use a > bang version of a particular RMagick method, you can always add it to the > Image class yourself using the code you show here. Errm, actually I think it's quite difficult to turn a non-bang method into a bang method. You can't change 'self' to point to be a different object, so I think you end up having to unpick the underlying class and modify all the instance variables explicitly. What I showed was how to turn a bang-method into a non-bang method (which is easy) Regards, Brian. > > > On Thu, 27 Feb 2003 23:33:13 +0900, Brian Candler wrote: > > > On Thu, Feb 27, 2003 at 11:19:46PM +0900, Tim Hunter wrote: > >> In the end which bang methods get added is mostly going to be decided > >> by user input. Which ones do you think would be useful? > > > > Could you catch them using method_missing? Or if you wrote them all as > > bang methods, you could wrap the non-bang methods as: > > > > def foo > > dup.foo! > > end > > > > (Array#sort is implemented like this, using Array#sort!). But maybe > > 'dup' isn't good enough in this case, as it's not a deep copy. Just a > > thought anyway. > > > > Regards, > > > > Brian. >