Method: Textbringer::Ring#push
- Defined in:
- lib/textbringer/ring.rb
#push(obj) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/textbringer/ring.rb', line 17 def push(obj) @current += 1 if @ring.size < @max @ring.insert(@current, obj) else if @current == @max @current = 0 end @on_delete.call(@ring[@current]) @ring[@current] = obj end end |