Can I evaluate a block inside a Proc?
问题 Can I yield a block inside a Proc? Consider this example: a = Proc.new do yield end a.call do puts "x" end What I'm trying to achieve is to print x , but interpreting this with ruby 2.0 raises LocalJumpError: no block given (yield) . 回答1: No you can't, because the Proc you've created is an independent yield - that is, it's a yield that has no block in its context. Although you can call procs with specified parameters and thereby pass the parameters into the proc, yield doesn't work based on