From: Matt Brooks Date: 2009-10-03T02:31:28+09:00 Subject: Re: Rolling String Buffer needed Aaron Patterson wrote: > > class MyBuff > def initialize max_size, filename > @max_size = max_size > @list = [] > @file = File.open(filename, 'wb') > end > > def push string > @list.push string > while @list.length > @max_size > @file.write @list.pop > end > end > > def [] i > @list[i] > end > end > > --- > Aaron Patterson > http://tenderlovemaking.com That looks great! So when I do pop on an array it does the highest index element? And when you push onto an array it puts it in index 0 ? Thanks! Matt -- Posted via http://www.ruby-forum.com/.