carlo-retryable 1.1 → 1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/retryable.rb +5 -4
  2. metadata +1 -1
@@ -4,15 +4,16 @@
4
4
 
5
5
  def retryable( options = {}, &block )
6
6
  opts = { :tries => 1, :on => Exception }.merge(options)
7
-
8
- retry_exception, retries = [ opts[:on] ].flatten, opts[:tries]
7
+
8
+ return nil if opts[:tries] == 0
9
+
10
+ retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]
9
11
 
10
12
  begin
11
13
  return yield
12
14
  rescue *retry_exception
13
- retry if (retries -= 1) > 0
15
+ retry if (tries -= 1) > 0
14
16
  end
15
17
 
16
18
  yield
17
19
  end
18
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carlo-retryable
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.1"
4
+ version: "1.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlo Zottmann