From: Florian Gross Date: 2004-09-24T02:39:32+09:00 Subject: Re: "no block given" with closure? Bob Sidebotham wrote: > When I execute this code, I get "no block given (LocalJumpError)": > > class S > def initialize(&b1) > @b1 = b1 > end > def each > @b1.call > end > end > > s = S.new {[1,2,3].each {|i| yield i }}.each {|v| puts v} The yield looks for blocks only in the method where it is used. I think this is by design. You might be able to work around this by using eval with a binding. But that wouldn't be any better than the solution where you yield the block. Regards, Florian Gross