Transforms all keys of a hash to strings.
Parameters:
Hash whose keys to convert.
Returns:
the new Hash with strings as keys.
18 19 20 21 22
# File 'lib/automata.rb', line 18 def self.keys_to_strings(obj) return obj unless obj.kind_of? Hash obj = obj.inject({}){|h,(k,v)| h[k.to_s] = Hash.keys_to_strings(v); h} return obj end