Hi -- On Sat, 12 Jan 2002, Albert L. Wagner wrote: > I do not understand why this code runs forever. Is it because > the yield is taken to be a second yield in the super class > "each"? Is there a way to do such nested iterators? > > class MyHash < Hash > def each(&block) > super.each do | k, v | The problem is right there. When you say 'super', you're calling Hash#each. And *then* you call 'each' on that -- so actually this #each is calling itself recursively. Change that line to: super do |k,v| because all you want to do is call the superclass's each -- you don't want to run the results through *this* each. David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav