retriable 1.3.2 → 1.3.3
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.
- data/README.md +8 -8
- data/lib/retriable/retriable.rb +1 -1
- data/lib/retriable/version.rb +1 -1
- data/retriable.gemspec +2 -2
- metadata +28 -10
data/README.md
CHANGED
@@ -3,7 +3,7 @@ Retriable
|
|
3
3
|
|
4
4
|
[](http://travis-ci.org/kamui/retriable)
|
5
5
|
|
6
|
-
Retriable is an simple DSL to retry code if an exception
|
6
|
+
Retriable is an simple DSL to retry a code block if an exception should be raised. This is especially useful when interacting external api/services or file system calls.
|
7
7
|
|
8
8
|
Installation
|
9
9
|
------------
|
@@ -28,7 +28,7 @@ gem 'retriable'
|
|
28
28
|
Usage
|
29
29
|
---------------
|
30
30
|
|
31
|
-
Code in a retriable block will be retried if an exception is raised. By default, Retriable will rescue any exception inherited from `
|
31
|
+
Code in a retriable block will be retried if an exception is raised. By default, Retriable will rescue any exception inherited from `StandardError` (and `Timeout::Error`, which does not inherit from `StandardError` in ruby 1.8) and make 3 retry attempts before raising the last exception.
|
32
32
|
|
33
33
|
```ruby
|
34
34
|
require 'retriable'
|
@@ -51,7 +51,7 @@ Here are the available options:
|
|
51
51
|
|
52
52
|
`timeout` (default: 0) - Number of seconds to allow the code block to run before raising a Timeout::Error
|
53
53
|
|
54
|
-
`on` (default:
|
54
|
+
`on` (default: [StandardError, Timeout::Error]) - `StandardError` and `Timeout::Error` or array of exceptions to rescue for each attempt
|
55
55
|
|
56
56
|
`on_retry` - (default: nil) - Proc to call after each attempt is rescued
|
57
57
|
|
@@ -106,7 +106,7 @@ begin
|
|
106
106
|
retriable do
|
107
107
|
# some code
|
108
108
|
end
|
109
|
-
rescue
|
109
|
+
rescue => e
|
110
110
|
# run this if retriable ends up re-rasing the exception
|
111
111
|
else
|
112
112
|
# run this if retriable doesn't raise any exceptions
|
@@ -115,9 +115,9 @@ ensure
|
|
115
115
|
end
|
116
116
|
```
|
117
117
|
|
118
|
-
Non Kernel
|
119
|
-
|
120
|
-
By default,
|
118
|
+
Non Kernel version
|
119
|
+
------------------
|
120
|
+
By default, `require 'retriable'` will include the `#retriable` method into the `Kernel` so that you can use it everywhere. If you don't want this behaviour, you can load a non-kernel version:
|
121
121
|
|
122
122
|
```ruby
|
123
123
|
gem 'retriable', require => 'retriable/no_kernel'
|
@@ -129,7 +129,7 @@ Or in your ruby script:
|
|
129
129
|
require 'retriable/no_kernel'
|
130
130
|
```
|
131
131
|
|
132
|
-
In this case, you'll just execute a retriable block from the Retriable module:
|
132
|
+
In this case, you'll just execute a retriable block from the `Retriable` module:
|
133
133
|
|
134
134
|
```ruby
|
135
135
|
Retriable.retriable do
|
data/lib/retriable/retriable.rb
CHANGED
data/lib/retriable/version.rb
CHANGED
data/retriable.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.authors = ["Jack Chu"]
|
11
11
|
s.email = ["jack@jackchu.com"]
|
12
12
|
s.homepage = %q{http://github.com/kamui/retriable}
|
13
|
-
s.summary = %q{Retriable is an simple DSL to retry code if an exception
|
14
|
-
s.description = %q{Retriable is an simple DSL to retry code if an exception
|
13
|
+
s.summary = %q{Retriable is an simple DSL to retry a code block if an exception should be raised.}
|
14
|
+
s.description = %q{Retriable is an simple DSL to retry a code block if an exception should be raised. This is especially useful when interacting external api/services or file system calls.}
|
15
15
|
|
16
16
|
s.rubyforge_project = "retriable"
|
17
17
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: retriable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: minitest
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,9 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
-
|
37
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Retriable is an simple DSL to retry a code block if an exception should
|
47
|
+
be raised. This is especially useful when interacting external api/services or file
|
48
|
+
system calls.
|
38
49
|
email:
|
39
50
|
- jack@jackchu.com
|
40
51
|
executables: []
|
@@ -67,17 +78,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
78
|
- - ! '>='
|
68
79
|
- !ruby/object:Gem::Version
|
69
80
|
version: '0'
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
hash: 1988275936415246250
|
70
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
85
|
none: false
|
72
86
|
requirements:
|
73
87
|
- - ! '>='
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
hash: 1988275936415246250
|
76
93
|
requirements: []
|
77
94
|
rubyforge_project: retriable
|
78
|
-
rubygems_version: 1.8.
|
95
|
+
rubygems_version: 1.8.24
|
79
96
|
signing_key:
|
80
97
|
specification_version: 3
|
81
|
-
summary: Retriable is an simple DSL to retry code if an exception
|
98
|
+
summary: Retriable is an simple DSL to retry a code block if an exception should be
|
99
|
+
raised.
|
82
100
|
test_files:
|
83
101
|
- test/retriable_test.rb
|