factbase 0.0.32 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/factbase.rb +8 -3
- data/test/test_factbase.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4434f46130fcb63e9fa798f3c6bacf8441e91a680f789015faf03ba5cb2296b3
|
4
|
+
data.tar.gz: 2d461a92eb2121ca9394e9c07128afa48e3f62a06290678eb68a869fb6fdd501
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a8683f418df4a0bd0de1d1f8be145a2eb4b1ea2e3bb7993355df88b591b6195dbac3654da7222ff3d66c1f3255c4dfb98520ff68f45721527138e258726d454
|
7
|
+
data.tar.gz: 027e1d0262aeca3ef34ea2a9ab3bdca0e6f6975c0f5478bee62e707f15668281bf2950be04f6cfca636d55a0b79ba9cd38e9a5679d8f63b7d800f69943b9b40c
|
data/lib/factbase.rb
CHANGED
@@ -29,7 +29,7 @@ require 'yaml'
|
|
29
29
|
# License:: MIT
|
30
30
|
class Factbase
|
31
31
|
# Current version of the gem (changed by .rultor.yml on every release)
|
32
|
-
VERSION = '0.0.
|
32
|
+
VERSION = '0.0.33'
|
33
33
|
|
34
34
|
# Constructor.
|
35
35
|
def initialize(facts = [])
|
@@ -86,8 +86,13 @@ class Factbase
|
|
86
86
|
copy = this.dup
|
87
87
|
yield copy
|
88
88
|
@mutex.synchronize do
|
89
|
-
|
90
|
-
|
89
|
+
after = Marshal.load(copy.export)
|
90
|
+
after.each_with_index do |m, i|
|
91
|
+
@maps << {} if i >= @maps.size
|
92
|
+
m.each do |k, v|
|
93
|
+
@maps[i][k] = v
|
94
|
+
end
|
95
|
+
end
|
91
96
|
end
|
92
97
|
end
|
93
98
|
|
data/test/test_factbase.rb
CHANGED
@@ -129,4 +129,16 @@ class TestFactbase < Minitest::Test
|
|
129
129
|
assert_equal(4, d.query('(always)').each.to_a.size)
|
130
130
|
end
|
131
131
|
end
|
132
|
+
|
133
|
+
def test_txn_inside_query
|
134
|
+
fb = Factbase.new
|
135
|
+
fb.insert.foo = 42
|
136
|
+
fb.query('(exists foo)').each do |f|
|
137
|
+
fb.txn do |fbt|
|
138
|
+
fbt.insert.bar = 33
|
139
|
+
end
|
140
|
+
f.xyz = 1
|
141
|
+
end
|
142
|
+
assert_equal(1, fb.query('(exists xyz)').each.to_a.size)
|
143
|
+
end
|
132
144
|
end
|