From: w_a_x_man Date: 2010-10-23T06:10:15+09:00 Subject: Re: Why no yield in 1.9.2 blocks? On Oct 22, 3:09 pm, Ed Howland wrote: > Hi, > > I searched in vain for the answer, but why doesn't yield work inside > Ruby 192 blocks. The syntax allows you to pass the blocks as a &blk > param, but you have to call the block with blk.call. If you try to use > yield, you get a LocalJumpError: > > ruby-1.9.2-p0 > l= lambda {|&blk| yield} >  => # > ruby-1.9.2-p0 > l.call {puts 1} > LocalJumpError: no block given (yield) >         from (irb):2:in `block in irb_binding' >         from (irb):3:in `call' >         from (irb):3 >         from /Users/edh/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `
' irb(main):002:0> p = proc{|&blk| yield} => # irb(main):003:0> p.call{puts 1} LocalJumpError: no block given from (irb):2 from (irb):3:in `call' from (irb):3 from :0 irb(main):004:0> VERSION => "1.8.7"