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 +4 -4
- data/.travis.yml +0 -3
- data/README.md +60 -60
- data/lib/tries.rb +1 -2
- data/lib/tries/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39c3c762cd40e7a2778449ef28fc7b886cf7ebdb
|
4
|
+
data.tar.gz: 455fc3ea5039c4de4958ce1ccbee29cab4c10644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80c1ceb4def0ddc86d66fa3107d0cbe2bcb9c0515d8a56960a602b25492af3fd2af6274ad32fe05a4e70bde71850a9286a0cffcd5e017cb7731d3504459a86b3
|
7
|
+
data.tar.gz: 376014bda0802a103ad71831e9c3729b9643e29d324a578ce44fc21f03c95d3b32e84a36ffd5d1eb597bad6be60972816edb702090a7b9b7446cb5450cc76d7b
|
data/.travis.yml
CHANGED
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
data/lib/tries/version.rb
CHANGED