class Sentry::BreadcrumbBuffer

Constants

DEFAULT_SIZE

Attributes

buffer[RW]

Public Class Methods

new(size = nil) click to toggle source
# File lib/sentry/breadcrumb_buffer.rb, line 10
def initialize(size = nil)
  @buffer = Array.new(size || DEFAULT_SIZE)
end

Public Instance Methods

dup() click to toggle source
Calls superclass method
# File lib/sentry/breadcrumb_buffer.rb, line 42
def dup
  copy = super
  copy.buffer = buffer.deep_dup
  copy
end
each(&block) click to toggle source
# File lib/sentry/breadcrumb_buffer.rb, line 28
def each(&block)
  members.each(&block)
end
empty?() click to toggle source
# File lib/sentry/breadcrumb_buffer.rb, line 32
def empty?
  members.none?
end
members() click to toggle source
# File lib/sentry/breadcrumb_buffer.rb, line 20
def members
  @buffer.compact
end
peek() click to toggle source
# File lib/sentry/breadcrumb_buffer.rb, line 24
def peek
  members.last
end
record(crumb) { |crumb| ... } click to toggle source
# File lib/sentry/breadcrumb_buffer.rb, line 14
def record(crumb)
  yield(crumb) if block_given?
  @buffer.slice!(0)
  @buffer << crumb
end
to_hash() click to toggle source
# File lib/sentry/breadcrumb_buffer.rb, line 36
def to_hash
  {
    values: members.map(&:to_hash)
  }
end