Sha256: 0922f1e98ba02ec1dc935eb387c9a827d1b1dbfdccbb992ac7bfbf9ca3be65c2
Contents?: true
Size: 708 Bytes
Versions: 23
Compression:
Stored size: 708 Bytes
Contents
require "sentry/breadcrumb" module Sentry class BreadcrumbBuffer DEFAULT_SIZE = 100 include Enumerable attr_accessor :buffer def initialize(size = nil) @buffer = Array.new(size || DEFAULT_SIZE) end def record(crumb) yield(crumb) if block_given? @buffer.slice!(0) @buffer << crumb end def members @buffer.compact end def peek members.last end def each(&block) members.each(&block) end def empty? members.none? end def to_hash { values: members.map(&:to_hash) } end def dup copy = super copy.buffer = buffer.deep_dup copy end end end
Version data entries
23 entries across 23 versions & 1 rubygems