Sha256: 0998fec92c023330fa07fd0ded14c98ba7ee0264dd52d68fa099463deab25cd3
Contents?: true
Size: 583 Bytes
Versions: 2
Compression:
Stored size: 583 Bytes
Contents
require 'delegate' module Honeybadger class Payload < SimpleDelegator attr_reader :max_depth def initialize(hash = {}, options = {}) fail ArgumentError, 'must be a Hash' unless hash.kind_of?(Hash) @max_depth = options[:max_depth] || 20 super(hash) sanitize(self) end private def sanitize(hash, depth = 0) hash.each_pair do |k,v| next unless v.kind_of?(Hash) if depth >= max_depth hash.delete(k) else hash[k] = sanitize(v, depth+1) end end hash end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
honeybadger-1.12.0.beta3 | lib/honeybadger/payload.rb |
honeybadger-1.12.0.beta2 | lib/honeybadger/payload.rb |