From: "Marcin Rzeźnicki" Date: 2013-06-10T20:56:39+09:00 Subject: Re: Class or method to convert hash keys to enable either string or symbol access? On Mon, Jun 10, 2013 at 1:22 PM, Tamara Temple wrote: > > I think I've seen this somewhere, but I can not recall where. Is there > some sort of class or method that will convert a hash so that all keys > may be accessed via a String or a Symbol, where the two are mapped > intelligently, and automatically upon assignment/creation of a key? > > So like: > > h['A key'] == h[:a_key] > > ? > I usually use 'hashie' gem for this kind of stuff eg. class Hash include Hashie::Extensions::SymbolizeKeys end or, class Hash include Hashie::Extensions::MergeInitializer include Hashie::Extensions::IndifferentAccess end etc. -- Pozdrawiam Marcin Rzeźnicki