Sha256: 7ce8ee69184e541eaffd4e2551ccb6d2deb899bcc52b44e5b195b9cbaae72095

Contents?: true

Size: 793 Bytes

Versions: 6

Compression:

Stored size: 793 Bytes

Contents

module Bugsnag
  module Helpers
    def self.cleanup_hash(hash)
      return nil unless hash
      hash.inject({}) do |h, (k, v)|
        h[k.to_s.gsub(/\./, "-")] = v.to_s
        h
      end
    end
    
    def self.apply_filters(hash, filters)
      return nil unless hash
      return hash unless filters

      hash.each do |k, v|
        if filters.any? {|f| k.to_s.include?(f.to_s) }
          hash[k] = "[FILTERED]"
        elsif v.respond_to?(:to_hash)
          apply_filters(hash[k])
        end
      end
    end
    
    def self.param_context(params)
      "#{params[:controller]}##{params[:action]}" if params && params[:controller] && params[:action]
    end

    def self.request_context(request)
      "#{request.request_method} #{request.path}" if request
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bugsnag-1.1.0 lib/bugsnag/helpers.rb
bugsnag-1.0.10 lib/bugsnag/helpers.rb
bugsnag-1.0.9 lib/bugsnag/helpers.rb
bugsnag-1.0.8 lib/bugsnag/helpers.rb
bugsnag-1.0.7 lib/bugsnag/helpers.rb
bugsnag-1.0.6 lib/bugsnag/helpers.rb