Sha256: 3ade91fb3212df58b40b816bd303e47bc1f015d6384b325d824e8e51341dcc0a
Contents?: true
Size: 576 Bytes
Versions: 12
Compression:
Stored size: 576 Bytes
Contents
module Propono module Utils # Returns +hash+ with all primary and nested keys to string values symbolised # To avoid conflicts with ActiveSupport and other libraries that provide Hash symbolisation, # this method is kept within the Propono namespace and not mixed into Hash def self.symbolize_keys(hash) hash.inject({}) do |result, (key, value)| new_key = key.is_a?(String) ? key.to_sym : key new_value = value.is_a?(Hash) ? symbolize_keys(value) : value result[new_key] = new_value result end end end end
Version data entries
12 entries across 12 versions & 1 rubygems