On Thu, 24 Aug 2006, Paul wrote:

> You are absolutely correct. Someone needed to override Hash with just a few
> methods and named the class OrderedHash.

     harp:~ > cat a.rb
     require 'yaml'
     require 'rubygems'
     require 'alib'       # gem install alib
     include Alib

     oh = OrderedHash.new
     oh['a'] = 0
     oh['b'] = 1
     oh['c'] = 2
     y 'oh' => oh
     y "oh.values_at('b', 'c')" => oh.values_at('b', 'c')


     oah = OrderedAutoHash.new
     oah['A']['a'] = 4
     oah['A']['b'] = 2
     oah['B']['a']['a'] = 4
     oah['B']['a']['b'] = 2
     y 'oah' => oah



     harp:~ > ruby a.rb
     oh:
       a: 0
       b: 1
       c: 2
     oh.values_at('b', 'c'):
     - 1
     - 2
     oah:
       A:
         a: 4
         b: 2
       B:
         a:
           a: 4
           b: 2


the OrderedAutoHash is really nice for generating reports/yaml.

regards.

-a
-- 
to foster inner awareness, introspection, and reasoning is more efficient than
meditation and prayer.
- h.h. the 14th dali lama