On 01/09/05, Philipp Huber <huber.philipp / gmail.com> wrote:
> hello!
> 
> first of all, i'm new to ruby and this list.
> 
> my question is, i have a class "Queue" which implements a queue as
> linked list of "Item" objects. i'd like to implement an each method,
> so i can do something like
> 
> queue.each do |item|
>    item.do_somethng
> end
> 
> any help would be appreciated!
> thanks,
> philipp
> 
> 

Just one more hint in case you didn't know it. You should do

class Queue
  include Enumerable
  ...
end

to get all the nice Enumerable methods for free.
     all?, any?, collect, detect, each_with_index, entries, find,
     find_all, grep, include?, inject, map, max, member?, min,
     partition, reject, select, sort, sort_by, to_a, to_set, zip

regards,

Brian

-- 
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/