Sha256: a22d430f7f99d9a14d658d0e41382f1287c89683fe60734b0cd2924be11b26ac

Contents?: true

Size: 599 Bytes

Versions: 20

Compression:

Stored size: 599 Bytes

Contents

module Appsignal
  module Utils
    def self.sanitize(params, only_top_level=false)
      if params.is_a?(Hash)
        {}.tap do |hsh|
          params.each do |key, val|
            hsh[key] = only_top_level ? '?' : sanitize(val, only_top_level)
          end
        end
      elsif params.is_a?(Array)
        if only_top_level
          sanitize(params[0], only_top_level)
        elsif params.first.is_a?(String)
          ['?']
        else
          params.map do |item|
            sanitize(item, only_top_level)
          end
        end
      else
        '?'
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
appsignal-1.0.4 lib/appsignal/utils.rb
appsignal-1.1.0.beta.6 lib/appsignal/utils.rb
appsignal-1.0.3 lib/appsignal/utils.rb
appsignal-1.0.3.beta.2 lib/appsignal/utils.rb
appsignal-1.0.3.beta.1 lib/appsignal/utils.rb
appsignal-1.1.0.beta.5 lib/appsignal/utils.rb
appsignal-1.1.0.beta.4 lib/appsignal/utils.rb
appsignal-1.1.0.beta.3 lib/appsignal/utils.rb
appsignal-1.1.0.beta.2 lib/appsignal/utils.rb
appsignal-1.1.0.beta.1 lib/appsignal/utils.rb
appsignal-1.0.2 lib/appsignal/utils.rb
appsignal-1.0.2.beta.4 lib/appsignal/utils.rb
appsignal-1.0.2.beta.3 lib/appsignal/utils.rb
appsignal-1.0.2.beta.2 lib/appsignal/utils.rb
appsignal-1.0.2.beta.1 lib/appsignal/utils.rb
appsignal-1.0.1 lib/appsignal/utils.rb
appsignal-1.0.0 lib/appsignal/utils.rb
appsignal-1.0.0.rc.1 lib/appsignal/utils.rb
appsignal-0.12.rc.14 lib/appsignal/utils.rb
appsignal-0.12.rc.13 lib/appsignal/utils.rb