Module: Rollbar::Truncation::Mixin

Instance Method Summary collapse

Instance Method Details

#dump(payload) ⇒ Object



4
5
6
# File 'lib/rollbar/truncation/mixin.rb', line 4

def dump(payload)
  Rollbar::JSON.dump(payload)
end

#select_frames(frames, range = 50) ⇒ Object



12
13
14
15
16
# File 'lib/rollbar/truncation/mixin.rb', line 12

def select_frames(frames, range = 50)
  return frames unless frames.count > range * 2

  frames[0, range] + frames[-range, range]
end

#truncate?(result) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/rollbar/truncation/mixin.rb', line 8

def truncate?(result)
  result.bytesize > MAX_PAYLOAD_SIZE
end