lib/timber/util/hash.rb in timber-2.0.8 vs lib/timber/util/hash.rb in timber-2.0.9

- old
+ new

@@ -1,9 +1,11 @@ module Timber module Util # @private module Hash + SANITIZED_VALUE = '[sanitized]'.freeze + extend self def deep_compact(hash) new_hash = {} @@ -18,9 +20,20 @@ new_hash[k] = v end end new_hash + end + + def sanitize(hash, keys_to_sanitize) + hash.each_with_object({}) do |(k, v), h| + k = k.to_s.downcase + if keys_to_sanitize.include?(k) + h[k] = SANITIZED_VALUE + else + h[k] = v + end + end end end end end \ No newline at end of file