Pergunta de entrevista da empresa Oracle

How to pass multiple blocks to a particular single method

Resposta da entrevista

Sigiloso

23 de mai. de 2019

def test(proc1, proc2) proc1.call proc2.call end test Proc.new{puts "1st block"}, Proc.new{puts "2nd block"} #Normal ways of calling/using block def test yield end test {puts "block call using yield"} def test(&block) block.call end test {puts "block call using block.call"} def test(proc) proc.call end test Proc.new{puts "block call using proc object and proc.call"}