From: Ralph Shnelvar Date: 2010-08-22T02:45:49+09:00 Subject: Adding *each* ------------731EF1FC9B5EF65 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit I'm trying to wrap my head around how to do an "each" for objects of a class that I have created. Consider this contrived example class X def initialize @x = [10, 'a', 'c', 9, 8] end end In Ruby 1.8, what's the magic incantation so that I can do x = X.new x.each {|y| puts y} I have read and reread Dave Thomas'*Programming Ruby 1.9* and ... well ... I think I have to define *each* in class X and add some enumerable stuff ... but ... I just don't get it. ------------731EF1FC9B5EF65--