Ruby: Continuer la boucle après l'interception d'une exception

En gros, je veux faire quelque chose comme ceci (en Python, ou d'autres langages):

for i in xrange(1, 5):
    try:
        do_something_that_might_raise_exceptions(i)
    except:
        continue    # continue the loop at i = i + 1

Comment dois-je faire en Ruby? Je sais qu'il y a de la redo et retry mots-clés, mais ils semblent pour ré-exécuter la "essayer" de bloc, au lieu de continuer la boucle:

for i in 1..5
    begin
        do_something_that_might_raise_exceptions(i)
    rescue
        retry    # do_something_* again, with same i
    end
end
InformationsquelleAutor Santa | 2010-04-12