Sha256: 976c1f278c8b9957b5637a9f9ad602eed1f5e9590ced81a58effb899073cdbb6

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 Bytes

Contents

module Raven
  class Processor::Truncator < Processor
    attr_accessor :event_bytesize_limit

    def initialize(client)
      super
      self.event_bytesize_limit = client.configuration.event_bytesize_limit
    end

    def process(value)
      value.each_with_object(value) { |(k, v), memo| memo[k] = truncate(v) }
    end

    def truncate(v)
      if v.respond_to?(:bytesize) && v.bytesize >= event_bytesize_limit
        v.byteslice(0...event_bytesize_limit)
      else
        v
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sentry-raven-1.2.3 lib/raven/processor/truncator.rb
sentry-raven-1.2.2 lib/raven/processor/truncator.rb