Sha256: 74c16ec1ec5dcac49ec8216e7c492f48f92601792c62e35ad95636544edd9740
Contents?: true
Size: 1.04 KB
Versions: 9
Compression:
Stored size: 1.04 KB
Contents
# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details. module NewRelic module Agent module HashExtensions module_function # recurses through hashes and arrays and stringifies keys def stringify_keys_in_object(object) case object when Hash object.inject({}) do |memo, (k, v)| memo[k.to_s] = stringify_keys_in_object(v) memo end when Array object.map {|o| stringify_keys_in_object(o)} else object end end # recurses through hashes and arrays and symbolizes keys def symbolize_keys_in_object(object) case object when Hash object.inject({}) do |memo, (k, v)| memo[k.to_sym] = symbolize_keys_in_object(v) memo end when Array object.map {|o| symbolize_keys_in_object(o)} else object end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems