From: "David A. Black" Date: 2008-04-12T01:32:18+09:00 Subject: Re: delete_if, select and (lack of) delete_if!, self.POLS == false Hi -- On Sat, 12 Apr 2008, Saku Ytti wrote: > Hey everyone, > > I was looking today for version of Array#select that would mutate the array > by deleting selected elements from it. > I first looked at delete_if, then noticed that it actually mutates original > array and returns mutated array. I wonder would it make sense for delete_if > not to mutate and return new array and delete_if! to mutate and return deleted > elements? > > Of course what I want is simple method to implement, it just seems pretty > typical desire for Array#select usage cases and also perhaps mutating > delete_if is as well bit unexpected? Problem is, suggested change would > break many current delete_if usage cases. You should use #reject, which is non-destructive. David -- Rails training from David A. Black and Ruby Power and Light: ADVANCING WITH RAILS April 14-17 New York City INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin See http://www.rubypal.com for details and updates!