Skip to content

Instantly share code, notes, and snippets.

@kjlape
Created August 15, 2016 14:22
Show Gist options
  • Select an option

  • Save kjlape/55f7119f29a3233b0c19e3040234c3bd to your computer and use it in GitHub Desktop.

Select an option

Save kjlape/55f7119f29a3233b0c19e3040234c3bd to your computer and use it in GitHub Desktop.
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