From: Robert Feldt Date: 2001-11-30T21:32:31+09:00 Subject: [ruby-talk:27056] Re: Using Enumerable On Fri, 30 Nov 2001, Peter Hickman wrote: > Im trying to write my own each method for a 'sort of' range class that > gets its data from > a file (but will have to process it before passing it on). The following > bit of code fails! > > Just how do you write an each method? > You might want to check out: "Blocks and Iterators" a bit down on the page http://www.rubycentral.com/book/tut_containers.html Its an intro to iterators in Ruby from the "pickaxe" book by Dave Thomas and Andy Hunt. The short answer is that you "call" the block given to each by writing "yield". Regards, /RobertF