From: Robert Klemme Date: 2010-06-29T21:06:38+09:00 Subject: Re: passing a block to yield 2010/6/28 Andy Bogdanov : >> There is no point in passing a block to yield > > Maybe there always is a way to avoid using procs and lambdas, but i > don't see other easy way in my case (see below). > Proc#call accepts blocks, why does yield not? It's almost the same > thing. > >> yield implicitly calls the block >> passed to the current method. > > Thanks for the tip. Forgot that yield belongs to method context only. > >> def each_child(&b) >>    b[self] # or b.call(self) or simply yield self >>    @children.each {|ch| ch.each_child(&b)} >>    self >> end > > This code will just pass all the elements to a block, there's no way to > wrap lower levels into