Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (21 sloc) 0.355 kb
class Memory
include Enumerable
def initialize(capacity)
@capacity = capacity
@memory = []
end
def <<(elem)
@memory << elem
@memory.shift if @memory.length > @capacity
self
end
def each(*args, &blk)
@memory.each(*args, &blk)
end
def length
@memory.length
end
def [](*args)
@memory[*args]
end
end
Jump to Line
Something went wrong with that request. Please try again.