Sha256: 1e7fb596cb3822b3d4195503611ad0486b22279f5317380d2ac0261e040914fa

Contents?: true

Size: 567 Bytes

Versions: 2

Compression:

Stored size: 567 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

2 entries across 2 versions & 1 rubygems

Version Path
sentry-raven-3.0.2 lib/raven/processor/removecircularreferences.rb
sentry-raven-3.0.1 lib/raven/processor/removecircularreferences.rb