Created
August 15, 2016 14:22
-
-
Save kjlape/55f7119f29a3233b0c19e3040234c3bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def doit | |
| yield | |
| end | |
| def do_retry | |
| doit do | |
| begin | |
| puts 'doing' | |
| yield | |
| puts 'done' | |
| rescue | |
| puts 'redoing' | |
| redo | |
| puts 'redone' | |
| end | |
| end | |
| end | |
| def test_do_retries(count) | |
| i = 0 | |
| do_retry do | |
| fail 'error' if (i += 1) < count | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment