Skip to content

Instantly share code, notes, and snippets.

@kenn
Created March 19, 2010 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenn/338330 to your computer and use it in GitHub Desktop.
Save kenn/338330 to your computer and use it in GitHub Desktop.
class RingBuffer < Array
def initialize(size)
@max = size
super(0)
end
def push(object)
shift if size == @max
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment