collectionadapters 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/collectionadapters/array_sequel.rb +4 -5
- data/lib/collectionadapters/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c32945a66d4431f74cc2e3085cab79150b234c5e67cbea22e2f38d97dece3d9
|
4
|
+
data.tar.gz: 223017655c0bb7404ca489b18ce4fa2fe854873f354cae99667d4f7043d0331a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6857663403eb0dd48b8919685a611121a1a4c4b63f9463cb0d663358d2cc244e85d2aab23bf8bc844b3bae075d6cc7f690b4fe2aedafced84baf4dd343521746
|
7
|
+
data.tar.gz: 03c49ee091a398585e3b940847e227928dbd8d145fbdeee49f691de693c65f708aad922f0c993df56fcbe0f9099fbd9639a863f038366f0d4ece8c0a6271bcca
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module CollectionAdapters
|
2
2
|
class ArraySequel
|
3
3
|
def initialize model:, column:
|
4
|
-
@
|
4
|
+
@ds = model
|
5
|
+
@model = model.kind_of?(Sequel::Dataset) ? @ds.model : @ds
|
5
6
|
@col = column.to_sym
|
6
7
|
end
|
7
8
|
|
@@ -24,8 +25,8 @@ module CollectionAdapters
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def shift
|
27
|
-
@
|
28
|
-
if ob = @
|
28
|
+
@ds.db.transaction do
|
29
|
+
if ob = @ds.for_update.first
|
29
30
|
v = ob.values[@col]
|
30
31
|
return v if ob.delete
|
31
32
|
raise Sequel::rollback
|
@@ -35,5 +36,3 @@ module CollectionAdapters
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
38
|
-
|
39
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: collectionadapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vidar Hokstad
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|