Sha256: f06fd6d188ac606f884da07122439412a69f8cb88cfec175921d54a320b42d68
Contents?: true
Size: 741 Bytes
Versions: 4
Compression:
Stored size: 741 Bytes
Contents
require "sentry/breadcrumb" module Sentry class BreadcrumbBuffer include Enumerable attr_accessor :buffer def initialize(size = 100) @buffer = Array.new(size) end def record(crumb = nil) if block_given? crumb = Breadcrumb.new if crumb.nil? yield(crumb) end @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
4 entries across 4 versions & 1 rubygems