I am aware of this feature provided by ActiveSupport.
h = ActiveSupport::OrderedOptions.new h.boy = \'John\' h.girl = \'Mary\' h.boy # => \'John\' h.girl # =
OpenStruct should work nicely for this.
If you want to see how it works, or perhaps make a customized version, start with something like this:
h = { 'boy' => 'John', 'girl' => 'Mary' } class << h def method_missing m self[m.to_s] end end puts h.nothing puts h.boy puts h.girl