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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53e563c36bf3d61f977bbae719a1b6069973a40b28f37ba4e3222f7fbae7091c
4
- data.tar.gz: ecd5e6b589ceda68f8a25369e6d7c169500dab90ac6bfca26af5384d0e74bdc9
3
+ metadata.gz: 4434f46130fcb63e9fa798f3c6bacf8441e91a680f789015faf03ba5cb2296b3
4
+ data.tar.gz: 2d461a92eb2121ca9394e9c07128afa48e3f62a06290678eb68a869fb6fdd501
5
5
  SHA512:
6
- metadata.gz: 7fc18cb91cd74af7e9e87b0740b10d1409278ce0dc8a7ea589ef8c45a5b61501dbe0706faf012a49862c911c25859d85a93ad1e6e275421af4c3255bcd5d1b2b
7
- data.tar.gz: bf4d812092097c9edb40ccd4aeac447b96906bbdbb515696199f9fa229d8e620ba36b2c80435e1d75115c07e5f2bac6029215df0657d03d51ceb42d053f6652c
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'
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
- @maps = []
90
- import(copy.export)
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
 
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko