Ruby Keyword: retry - rking/pry-docmore GitHub Wiki
Re-run the block that raised an Exception.
For example:
tries = 3
begin
puts "Try ##{tries}."
1/0
rescue => e
tries -= 1
retry unless tries.zero?
end
This will output:
Try #3.
Try #2.
Try #1.
See also: begin, rescue, else, ensure