# class Raven::BreadcrumbBuffer

### Attributes

buffer[RW]

### Public Class Methods

clear!() click to toggle source

    # File sentry-raven/lib/raven/breadcrumbs.rb, line 37
    def self.clear!
      Thread.current[:sentry_breadcrumbs] = nil
    end

current() click to toggle source

    # File sentry-raven/lib/raven/breadcrumbs.rb, line 33
    def self.current
      Thread.current[:sentry_breadcrumbs] ||= new
    end

new(size = 100) click to toggle source

    # File sentry-raven/lib/raven/breadcrumbs.rb, line 41
    def initialize(size = 100)
      @buffer = Array.new(size)
    end

### Public Instance Methods

each(&block) click to toggle source

    # File sentry-raven/lib/raven/breadcrumbs.rb, line 62
    def each(&block)
      members.each(&block)
    end

empty?() click to toggle source

    # File sentry-raven/lib/raven/breadcrumbs.rb, line 66
    def empty?
      members.none?
    end

members() click to toggle source

    # File sentry-raven/lib/raven/breadcrumbs.rb, line 54
    def members
      @buffer.compact
    end

peek() click to toggle source

    # File sentry-raven/lib/raven/breadcrumbs.rb, line 58
    def peek
      members.last
    end

record(crumb = nil) { |crumb| ... } click to toggle source

    # File sentry-raven/lib/raven/breadcrumbs.rb, line 45
    def record(crumb = nil)
      if block_given?
        crumb = Breadcrumb.new if crumb.nil?
        yield(crumb)
      end
      @buffer.slice!(0)
      @buffer << crumb
    end

to_hash() click to toggle source

    # File sentry-raven/lib/raven/breadcrumbs.rb, line 70
    def to_hash
      {
        :values => members.map(&:to_hash)
      }
    end