Module: HashExtensions
- Defined in:
- lib/audrey2.rb
Overview
Adapted from gist.github.com/151324 by Avdi Grimm and Paul Berry
Instance Method Summary collapse
Instance Method Details
#recursively_symbolize_keys ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/audrey2.rb', line 9 def recursively_symbolize_keys inject({}) do |acc, (k,v)| key = String === k ? k.to_sym : k value = case v when Hash v.recursively_symbolize_keys when Array v.collect { |e| Hash === e ? e.recursively_symbolize_keys : e } else v end acc[key] = value acc end end |