tries 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 858991b157959d16b2013139b86b0177bf8fa8f7
4
- data.tar.gz: 78375500627b00b518e892279a631421287fb2fb
3
+ metadata.gz: 39c3c762cd40e7a2778449ef28fc7b886cf7ebdb
4
+ data.tar.gz: 455fc3ea5039c4de4958ce1ccbee29cab4c10644
5
5
  SHA512:
6
- metadata.gz: 2c0552f9fb62b8bbf2ab74221ed5b89d67a27dc35ca88a7907849ce244a1c734a2f1ecd0c6fada7cf1a99e15be01a52e0403820dc919cc43e89df6cfd27577c1
7
- data.tar.gz: 8fd511848722e6f26db4ffa07ad06cbf8cd556f83ab47ebcf5e7f62f5def8b2ae0cb0a6e3aaf3430d35ebbd9ff4e4df29937ef56ad0a4ab2983e67486764e5a8
6
+ metadata.gz: 80c1ceb4def0ddc86d66fa3107d0cbe2bcb9c0515d8a56960a602b25492af3fd2af6274ad32fe05a4e70bde71850a9286a0cffcd5e017cb7731d3504459a86b3
7
+ data.tar.gz: 376014bda0802a103ad71831e9c3729b9643e29d324a578ce44fc21f03c95d3b32e84a36ffd5d1eb597bad6be60972816edb702090a7b9b7446cb5450cc76d7b
data/.travis.yml CHANGED
@@ -5,6 +5,3 @@ rvm:
5
5
  - 2.0.0
6
6
  - jruby-19mode
7
7
  - rbx-19mode
8
- matrix:
9
- allow_failures:
10
- - rvm: 2.0.0
data/README.md CHANGED
@@ -71,12 +71,12 @@ end
71
71
  method_that_raises_exception
72
72
  end
73
73
 
74
- => Counter is 1
75
- => Counter is 2
76
- => Counter is 3
77
- => Counter is 4
78
- => Counter is 5
79
- => You made it through!
74
+ # => Counter is 1
75
+ # => Counter is 2
76
+ # => Counter is 3
77
+ # => Counter is 4
78
+ # => Counter is 5
79
+ # => You made it through!
80
80
  ```
81
81
 
82
82
  ### Rescue a specific error
@@ -86,10 +86,10 @@ end
86
86
  method_that_raises_exception
87
87
  end
88
88
 
89
- => Counter is 1
90
- => Counter is 2
91
- => Counter is 3
92
- => BarError
89
+ # => Counter is 1
90
+ # => Counter is 2
91
+ # => Counter is 3
92
+ # => BarError
93
93
  ```
94
94
 
95
95
  ### Rescue multiple errors
@@ -99,11 +99,11 @@ end
99
99
  method_that_raises_exception
100
100
  end
101
101
 
102
- => Counter is 1
103
- => Counter is 2
104
- => Counter is 3
105
- => Counter is 4
106
- => StandardError
102
+ # => Counter is 1
103
+ # => Counter is 2
104
+ # => Counter is 3
105
+ # => Counter is 4
106
+ # => StandardError
107
107
  ```
108
108
 
109
109
  ### Delay execution after error
@@ -117,16 +117,16 @@ end
117
117
  method_that_raises_exception
118
118
  end
119
119
 
120
- => Counter is 1
121
- waits 1.5 seconds...
122
- => Counter is 2
123
- waits 1.5 seconds...
124
- => Counter is 3
125
- waits 1.5 seconds...
126
- => Counter is 4
127
- waits 1.5 seconds...
128
- => Counter is 5
129
- => You made it through!
120
+ # => Counter is 1
121
+ # waits 1.5 seconds...
122
+ # => Counter is 2
123
+ # waits 1.5 seconds...
124
+ # => Counter is 3
125
+ # waits 1.5 seconds...
126
+ # => Counter is 4
127
+ # waits 1.5 seconds...
128
+ # => Counter is 5
129
+ # => You made it through!
130
130
  ```
131
131
 
132
132
  #### Incremental delay
@@ -136,16 +136,16 @@ waits 1.5 seconds...
136
136
  method_that_raises_exception
137
137
  end
138
138
 
139
- => Counter is 1
140
- waits 1.5 seconds...
141
- => Counter is 2
142
- waits 3 seconds...
143
- => Counter is 3
144
- waits 4.5 seconds...
145
- => Counter is 4
146
- waits 6 seconds...
147
- => Counter is 5
148
- => You made it through!
139
+ # => Counter is 1
140
+ # waits 1.5 seconds...
141
+ # => Counter is 2
142
+ # waits 3 seconds...
143
+ # => Counter is 3
144
+ # waits 4.5 seconds...
145
+ # => Counter is 4
146
+ # waits 6 seconds...
147
+ # => Counter is 5
148
+ # => You made it through!
149
149
  ```
150
150
 
151
151
  ### Callback on error
@@ -173,20 +173,20 @@ end
173
173
  method_that_raises_exception
174
174
  end
175
175
 
176
- => Counter is 1
177
- => Whow, a FooError just occurred! It was attempt nr. 1 to do whatever I was doing.
178
- => I'm gonna wait 0.5 seconds and try again.
179
- waits 0.5 seconds...
180
- => Counter is 2
181
- => Whow, a FooError just occurred! It was attempt nr. 2 to do whatever I was doing.
182
- => I'm gonna wait 1.0 seconds and try again.
183
- waits 1 second...
184
- => Counter is 3
185
- => Whow, a BarError just occurred! It was attempt nr. 3 to do whatever I was doing.
186
- => I'm gonna wait 1.5 seconds and try again.
187
- waits 1.5 seconds...
188
- => Counter is 4
189
- => StandardError
176
+ # => Counter is 1
177
+ # => Whow, a FooError just occurred! It was attempt nr. 1 to do whatever I was doing.
178
+ # => I'm gonna wait 0.5 seconds and try again.
179
+ # waits 0.5 seconds...
180
+ # => Counter is 2
181
+ # => Whow, a FooError just occurred! It was attempt nr. 2 to do whatever I was doing.
182
+ # => I'm gonna wait 1.0 seconds and try again.
183
+ # waits 1 second...
184
+ # => Counter is 3
185
+ # => Whow, a BarError just occurred! It was attempt nr. 3 to do whatever I was doing.
186
+ # => I'm gonna wait 1.5 seconds and try again.
187
+ # waits 1.5 seconds...
188
+ # => Counter is 4
189
+ # => StandardError
190
190
  ```
191
191
 
192
192
  #### Local callback
@@ -200,17 +200,17 @@ end
200
200
  method_that_raises_exception
201
201
  end
202
202
 
203
- => Counter is 1
204
- => Local callback! Exception: FooError, attempt: 1, next_delay: 0.5
205
- waits 0.5 seconds...
206
- => Counter is 2
207
- => Local callback! Exception: FooError, attempt: 2, next_delay: 1.0
208
- waits 1 second...
209
- => Counter is 3
210
- => Local callback! Exception: BarError, attempt: 3, next_delay: 1.5
211
- waits 1.5 seconds...
212
- => Counter is 4
213
- => StandardError
203
+ # => Counter is 1
204
+ # => Local callback! Exception: FooError, attempt: 1, next_delay: 0.5
205
+ # waits 0.5 seconds...
206
+ # => Counter is 2
207
+ # => Local callback! Exception: FooError, attempt: 2, next_delay: 1.0
208
+ # waits 1 second...
209
+ # => Counter is 3
210
+ # => Local callback! Exception: BarError, attempt: 3, next_delay: 1.5
211
+ # waits 1.5 seconds...
212
+ # => Counter is 4
213
+ # => StandardError
214
214
  ```
215
215
 
216
216
  ## Contributing
data/lib/tries.rb CHANGED
@@ -32,7 +32,6 @@ class Integer
32
32
  private
33
33
  def calculate_delay(delay, attempts, incremental)
34
34
  return delay unless incremental
35
-
36
- delay * attempts
35
+ (delay * attempts * 100).round.to_f / 100
37
36
  end
38
37
  end
data/lib/tries/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tries
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Meurer