From: Jamis Buck Date: 2004-11-03T07:01:02+09:00 Subject: Re: Converting hash keys to symbols Michael Neumann wrote: > But you should not do this for random strings, as symbols are AFAIK not > GC'ed. Good point. I hadn't considered that. However, for what I'm doing, there are no more than a double-handful of unique, valid strings and symbols, so I don't think memory is an issue. > > How about this (converts all symbols to strings, which is easier and > more secure, as strings get GC'ed): > > h = Hash.new > a.each {|k,v| h[k.to_s.tr('-','_')] = v} > h Ah, #tr is what I was looking for. Thanks! That's one step towards making it more elegant, anyway. Thanks, Michael! - Jamis -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis