From: Kent Dahl Date: 2002-06-10T17:39:26+09:00 Subject: Re: Getting method! for free from method Philip Mak wrote: > > Let's say I have: > > def method > # do something > end > > Is there a shortcut for telling ruby to define method! for me? As others have pointed out, nope. Just like to share that I tend to do the opposite sometimes, and that isn't so difficult: def method! # mutate the object end def method result = self.dup result.method! end Well, this works if the intent and behaviour of dup isn't at odds. And you could probably make an evil-eval module function for a shortcut that makes the non-mutator version of the method for you. -- (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 4. year ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)