From: "David A. Black" Date: 2005-04-24T00:30:57+09:00 Subject: Re: Suggestion: Hash.remove --927295978-849992707-1114270237=:10750 Content-Type: MULTIPART/MIXED; BOUNDARY="927295978-849992707-1114270237=:10750" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --927295978-849992707-1114270237=:10750 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Sat, 23 Apr 2005, [ISO-8859-1] Florian Gro=DF wrote: > Andrew Walrond wrote: > >> Something I often find useful is a version of Hash.delete which returns = the=20 >> hash rather than the deleted item. Useful for terse chained code. > > You want to do hash.delete("foo").delete("bar").delete("qux"). > > Why don't you do this? > > %w(foo bar qux).each do |key| > hash.delete(key) > end > > New keys can easily be added and is not repetitive at all. > > Perhaps you could instead change your proposal to make .delete() accept= =20 > multiple keys? Or a delete_at for hash (similar to the array one). David --=20 David A. Black dblack@wobblini.net --927295978-849992707-1114270237=:10750-- --927295978-849992707-1114270237=:10750--