lib/tins/attempt.rb in tins-0.3.6 vs lib/tins/attempt.rb in tins-0.3.7
- old
+ new
@@ -7,10 +7,11 @@
attempts = opts
else
attempts = opts[:attempts] || 1
exception_class = opts[:exception_class] if opts.key?(:exception_class)
sleep = opts[:sleep]
+ reraise = opts[:reraise]
end
return if attempts <= 0
count = 0
if exception_class.nil?
begin
@@ -30,10 +31,10 @@
rescue exception_class
if count < attempts
sleep_duration(sleep, count)
retry
end
- false
+ reraise ? raise : false
end
end
end
private