Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/automata.rb
Class Method Summary collapse
-
.keys_to_strings(obj) ⇒ Hash
Transforms all keys of a hash to strings.
Class Method Details
.keys_to_strings(obj) ⇒ Hash
Transforms all keys of a hash to strings.
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 |