Sha256: e0f861c96a5e6f480efb24d5595e4a72a4ee9544e3cb89848a93a32ad801482c

Contents?: true

Size: 566 Bytes

Versions: 27

Compression:

Stored size: 566 Bytes

Contents

module Raven
  class Processor::RemoveCircularReferences < Processor
    def process(value, visited = [])
      return "(...)" if visited.include?(value.__id__)
      visited << value.__id__ if value.is_a?(Array) || value.is_a?(Hash)

      case value
      when Hash
        !value.frozen? ? value.merge!(value) { |_, v| process v, visited } : value.merge(value) { |_, v| process v, visited }
      when Array
        !value.frozen? ? value.map! { |v| process v, visited } : value.map { |v| process v, visited }
      else
        value
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 3 rubygems

Version Path
sentry-raven-2.6.2 lib/raven/processor/removecircularreferences.rb
sentry-raven-2.6.1 lib/raven/processor/removecircularreferences.rb
sentry-raven-2.6.0 lib/raven/processor/removecircularreferences.rb
sentry-raven-2.5.3 lib/raven/processor/removecircularreferences.rb
sentry-raven-2.5.2 lib/raven/processor/removecircularreferences.rb
sentry-raven-2.5.1 lib/raven/processor/removecircularreferences.rb
sentry-raven-2.5.0 lib/raven/processor/removecircularreferences.rb