cymbal
Convert Ruby hash keys from strings to symbols for easier manipulation
Usage
require 'cymbal'
x = {
'foo' => 1,
'bar' => {
'cats' => 6,
'dogs' => 'better'
}
}
Cymbal.symbolize(x) # returns {:foo=>1, :bar=>{:cats=>6, :dogs=>"better"}}
The symbolize call will convert keys recursively and will handle an array of hashes.
If a hash includes keys that would collide (for example, :foo and 'foo'), an ArgumentError will be raised.
Installation
gem install cymbal
License
cymbal is released under the MIT License. See the bundled LICENSE file for details.