What would be the easiest/fastest way to convert Hash keys

Hello.

I was wondering, what would be the easiest and fastest way to convert
Hash keys from Symbol objects to String?

I came up with something like this, but I think that maybe there’s some
better Ruby-way to do it:

tmp = {}
h.each_pair {|k, v| tmp[k.to_s] = v}
h = tmp

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs