idempotent_transaction 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/LICENSE.txt +21 -0
- data/README.md +1 -1
- data/lib/idempotent_transaction.rb +9 -9
- data/lib/idempotent_transaction/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce9d97fae14defc1d003ed97c3ae7a5f1a2f78e81d6ff380f7290409622fcad7
|
4
|
+
data.tar.gz: 577db0f386bd1b10dc58f37257f92bfed998722f5d15ca01c2558665185b47a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a7f7b05b3fb196fedaa938180392865588e4298368936397af8af6d9ff959e202d71d589f4ea511d180817d84e4a2deb7ab914f9a4d26fb7e5d6948bdfe602d
|
7
|
+
data.tar.gz: 9948c2b8ac6f1d8a405afe3b380496f2fef0939e871d995f77321cedfb0042a29e5dfd0898aeb6835fa907edb2773676d38e86ad72bc53788e6c4c8e12f7f8d8
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 ota42y
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -25,16 +25,16 @@ module IdempotentTransaction
|
|
25
25
|
|
26
26
|
def idempotent_transaction(force: false)
|
27
27
|
self.class.transaction do
|
28
|
-
yield
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
yield.tap do
|
29
|
+
begin
|
30
|
+
save!
|
31
|
+
rescue ActiveRecord::RecordNotUnique
|
32
|
+
raise ActiveRecord::Rollback unless force
|
33
|
+
end
|
34
|
+
|
35
|
+
@finished = true
|
36
|
+
@executed = true
|
34
37
|
end
|
35
|
-
|
36
|
-
@finished = true
|
37
|
-
@executed = true
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idempotent_transaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ota42y
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -119,8 +119,10 @@ files:
|
|
119
119
|
- ".rspec"
|
120
120
|
- ".rubocop.yml"
|
121
121
|
- ".travis.yml"
|
122
|
+
- CHANGELOG.md
|
122
123
|
- CODE_OF_CONDUCT.md
|
123
124
|
- Gemfile
|
125
|
+
- LICENSE.txt
|
124
126
|
- README.md
|
125
127
|
- Rakefile
|
126
128
|
- bin/console
|