Module: Akane::Util

Defined in:
lib/akane/util.rb

Class Method Summary collapse

Class Method Details

.symbolish_hash(hash) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/akane/util.rb', line 4

def symbolish_hash(hash)
  Hash[hash.map { |k, v|
    [
      k.is_a?(Symbol) ? k : k.to_s.to_sym,
      case v
      when Hash; symbolish_hash(v)
      when Array; v.map{ |i| i.kind_of?(Hash) ? symbolish_hash(i) : i }
      else; v
      end
    ]
  }]
end