Skip to content

Instantly share code, notes, and snippets.

@riffraff
Created July 11, 2012 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riffraff/3088764 to your computer and use it in GitHub Desktop.
Save riffraff/3088764 to your computer and use it in GitHub Desktop.
# possible now
def retrying times=x # or strategy
attempt = 0
yield
rescue
attempt+=1
retry if attempt < times # or retry if strategy
end
retrying(1) { open_url }
# what I'd love to have but I think it's somewhat impossible, hacky to do right
def foo
open url
rescue
retry once
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment