class Pry::Ring

A ring is a thread-safe fixed-capacity array to which you can only add elements. Older entries are overwritten as you add new elements, so that the ring can never contain more than ‘max_size` elements.

@example

ring = Pry::Ring.new(3)
ring << 1 << 2 << 3
ring.to_a #=> [1, 2, 3]
ring << 4
ring.to_a #=> [2, 3, 4]

ring[0] #=> 2
ring[-1] #=> 4
ring.clear
ring[0] #=> nil

@api public @since v0.12.0