jobs.each do |job| msg job.name do break if stop_all_jobs? job.run! endend def msg(msg, &block) puts 'START '+ msg yield puts 'END '+ msgend
In the above example break
does not break out of the loop as expected. It only breaks out of the msg
code block.
This seems a little odd, but I guess it is based on context, that said, how do I break out of the loop from code which is within a yield
ed code block?