From: Tobias Peters Date: 2003-04-14T22:58:32+09:00 Subject: Re: [Q] A class, that knows about it's instances + Sets On Mon, 14 Apr 2003, KONTRA Gergely wrote: > Or I would be happy, if I can do > MyClass.each{|a| ... } > > I can do it in one class, BUT, I need it as a module, because I cannot > subclass my class from that class? module Instance_Iterator include Enumerable def each(&block) ObjectSpace.each_object(self, &block) end end MyClass.extend(Instance_Iterator)