From: Stephen White Date: 2001-08-31T13:18:09+09:00 Subject: [ruby-talk:20598] Re: ordered hash On 31 Aug 2001 12:01:15 +0900, Dave Vandervort wrote: > > class OrderedHash < Hash There's a bug in this as it stands... > > def []=(key, val) > > @keys << key > > super > > end It's not checking to see if the key already exists. The Hash will replace the old entry but the Array will append a new entry. > > def delete(key) > > @keys.delete(key) > > super > > end Same problem. Try probing for the key in the Hash (quick) to see what to do with the Array. Nice wrapper though.