Circular buffer in Ruby