Sha256: 14c51f433c7a8df4271295462cbd237f0f3c6d7bdd867eb5937357d4be7a266e

Contents?: true

Size: 667 Bytes

Versions: 6

Compression:

Stored size: 667 Bytes

Contents

module Appsignal
  class ParamsSanitizer
    class << self
      def sanitize(params)
        sanitize_hash(params)
      end

      protected

      def sanitize_hash(hash)
        out = {}
        hash.each_pair do |key, value|
          out[key] = sanitize_value(value)
        end
        out
      end

      def sanitize_array(array)
        array.map { |value| sanitize_value(value) }
      end

      def sanitize_value(value)
        case value
        when Hash
          sanitize_hash(value)
        when Array
          sanitize_array(value)
        when String
          value
        else
          value.inspect
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
appsignal-0.4.7 lib/appsignal/transaction/params_sanitizer.rb
appsignal-0.4.6 lib/appsignal/transaction/params_sanitizer.rb
appsignal-0.4.5 lib/appsignal/transaction/params_sanitizer.rb
appsignal-0.4.4 lib/appsignal/transaction/params_sanitizer.rb
appsignal-0.4.3 lib/appsignal/transaction/params_sanitizer.rb
appsignal-0.4.0 lib/appsignal/transaction/params_sanitizer.rb