From: Paul Battley Date: 2006-05-17T18:55:18+09:00 Subject: Re: Blocks in Procs? On 17/05/06, travis michel wrote:> I expect the following to print "Hello World", but it does not:>> #!/usr/bin/env ruby>> x = Proc.new { |a| p( block_given? ? yield(a) : a ) }> x.call( 'World' ) { |b| p "Hello #{b}" } Is this any use to you? x = Proc.new { |*a| a[1] ? a[1].call(a[0]) : a[0] }p x.call( 'Boo' )p x.call( 'World', Proc.new{ |b| "Hello #{b}" } ) "Boo""Hello World" Regards,Paul.