From: nobuyoshi nakada Date: 2005-08-09T12:28:38+09:00 Subject: Re: Storing a block and calling it later wanting it to return put of the method it's called in. Hi, At Tue, 9 Aug 2005 11:36:09 +0900, Trans wrote in [ruby-talk:151317]: > > class D > def initialize(&blk) > @blk = blk > end > > def lambda_return > lambda { return 'Y' }.call ; 'N' > end > > def proc_return > Proc.new { return 'Y' }.call ; 'N' > end > > def lambda_return_blk > lambda(&@blk).call ; 'N' > end > > def proc_return_blk Proc.new(&@blk).call rescue LocalJumpError => e raise unless e.backtrace.size == caller.size+2 e.exit_value else 'N' > end > > end -- Nobu Nakada