From: Alan Chen Date: 2002-07-12T05:46:31+09:00 Subject: Re: new to ruby,how to make FIFO in ruby? On Fri, Jul 12, 2002 at 05:17:20AM +0900, Maggie Xiao wrote: > Hi, > > Is there anyone can tell me how to make FIFO in ruby? I cannot find the > related method? Thanks. > > Maggie Well, you use a Array push and shift. If you want this behavior could be coded as: class Simple_FIFO def initialize @data = Array.new end def push(val) @data.push(val) end def pop(val) @data.shift(val) end end Error handling is left as an excercise to the reader :) - alan -- Alan Chen Digikata LLC http://digikata.com