From: Just Another Victim of the Ambient Morality Date: 2006-08-22T01:50:07+09:00 Subject: Re: Why Does Hash Apparently Reorder Its Internal Representation And Other Associated Ponderings "Martin DeMello" wrote in message news:f93a6bcc0608210510j438b2d58l1d485c707810f571@mail.gmail.com... > On 8/21/06, Bil Kleb wrote: >> Martin DeMello wrote: >> > On 8/21/06, Bil Kleb wrote: >> > >> > You can do this automatically (if you aren't already) by creating an >> > object that holds a hash and an array, defines []=, each and delete to >> > do the right thing, and delegates missing methods to the hash. >> >> Hmmm... good idea. I've largely missed out on the >> whole method_missing idiom. Sounds like a good use. >> >> I'll try to look into it after I return from JPL next >> week. However, if you'd like to throw down an example, >> I might be able to work it in now... > > Quick proof of concept: > > require 'enumerator' > > class OHash > include Enumerable > > ... > > def method_missing(*args) > @h.send(*args) > end > end Is there a reason why you don't simply inheret from Hash, or is this just another one of those There's More Than One Way To Do It scenarios?