Hi -- On Tue, 22 Aug 2006, Just Another Victim of the Ambient Morality wrote: > > "Martin DeMello" <martindemello / gmail.com> wrote in message > news:f93a6bcc0608210510j438b2d58l1d485c707810f571 / mail.gmail.com... >> On 8/21/06, Bil Kleb <Bil.Kleb / nasa.gov> wrote: >>> Martin DeMello wrote: >>>> On 8/21/06, Bil Kleb <Bil.Kleb / nasa.gov> 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? You mean TMTOTMTOWTDIS? :-) David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.