Sha256: 927600f2d287d6fa3a365f9bad90fa39a2d226b9e2549d4c9396987e019688a7
Contents?: true
Size: 716 Bytes
Versions: 7
Compression:
Stored size: 716 Bytes
Contents
module RailsAdmin class HashHelper def self.symbolize(obj) case obj when Array obj.each_with_object([]) do |val, res| res << case val when Hash, Array then symbolize(val) when String then val.to_sym else val end end when Hash obj.each_with_object({}) do |(key, val), res| nkey = key.is_a?(String) ? key.to_sym : key nval = case val when Hash, Array then symbolize(val) when String then val.to_sym else val end res[nkey] = nval end else obj end end end end
Version data entries
7 entries across 7 versions & 1 rubygems