From: Rick DeNatale Date: 2008-02-12T06:20:00+09:00 Subject: Re: Deleting values of array elements On 2/11/08, Jonas Schneider wrote: > On 11 Feb., 18:07, Robert Klemme wrote: > > a.map {|x| x.dup.delete :prop} > > yay, works great =) > > only problem: The array actually consists of objects, I forgot. > So they dont have the delete method. > I've now done this with _x.dup.prop = nil; x_ but it seems a little > ugly to have that nil still in there. > I know, in PHP there is the unset function; is there somethin > aequivalent in ruby to get rid of it completely? Not as far as I know in Ruby < 1.9 Ruby 1.9 has a private Object#remove_instance_variable method, but unless you are using the defined? operator you really can't tell whether an instance variable exists since just referring to it creates it if it doesn't already exist. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/