Sha256: 9fd67419a22aa38d9bd508793bb6370630181a2b5a5f64792879d31214604529
Contents?: true
Size: 612 Bytes
Versions: 106
Compression:
Stored size: 612 Bytes
Contents
module Tins module HashSymbolizeKeysRecursive def symbolize_keys_recursive inject(self.class.new) do |h,(k, v)| k = k.to_s k.empty? and next 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
106 entries across 102 versions & 9 rubygems