Sha256: a252e83e970f607a4ff187eace097fcc379af6616a235b9a8f4ebcb7e810db2b
Contents?: true
Size: 586 Bytes
Versions: 21
Compression:
Stored size: 586 Bytes
Contents
module Tins module HashSymbolizeKeysRecursive def symbolize_keys_recursive inject(self.class.new) do |h,(k, v)| k = k.to_s case v when Hash h[k.to_sym] = v.symbolize_keys_recursive when Array h[k.to_sym] = a = v.dup v.each_with_index do |x, i| Hash === x and a[i] = x.symbolize_keys_recursive end else h[k.to_sym] = v end h end end def symbolize_keys_recursive! replace symbolize_keys_recursive end end end require 'tins/alias'
Version data entries
21 entries across 20 versions & 2 rubygems