Sha256: ea47d9d52cd0c063b30a6b737abd06268055f4fa41c3e173e2d535c63b4d3007
Contents?: true
Size: 398 Bytes
Versions: 15
Compression:
Stored size: 398 Bytes
Contents
class Hash def symbolize_keys(item=self) case item when Array item.map do |i| symbolize_keys(i) end when Hash Hash[ item.map do |key, value| new_key = key.is_a?(String) ? key.to_sym : key new_value = symbolize_keys(value) [new_key, new_value] end ] else item end end end
Version data entries
15 entries across 15 versions & 1 rubygems