factbase 0.0.55 → 0.0.56
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/factbase/rules.rb +6 -2
- data/lib/factbase.rb +1 -1
- data/test/factbase/test_rules.rb +8 -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: d26f7abaafccccb51ef4077d66fed7a4a8ef846df2a7d46191d7113b27a2a689
|
4
|
+
data.tar.gz: 8d0a64e42a4a695edc7ef5a7958ceb69aa6a965e53778782bd865c49a8752a4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65c7a43401b8933e212dea979319cc75a0e42349123f0cd98871ee4d1493002b2f280a229820101ef481168c64a2e97333a549036dd3c88dfa3d05b4230d9085
|
7
|
+
data.tar.gz: 9106f2c57b7840e95de6a6dba53859f0d0c4e0bea5770b22d558c35894e847145fe0b9d5640d017441baa91be48bcbc4a09cf38ae8390ab9d0efe379b5add37b
|
data/lib/factbase/rules.rb
CHANGED
@@ -142,12 +142,16 @@ class Factbase::Rules
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def it(fact)
|
145
|
-
|
145
|
+
a = fact[@uid]
|
146
|
+
return if a.nil?
|
147
|
+
@facts << a[0] unless @uid.nil?
|
146
148
|
end
|
147
149
|
|
148
150
|
def include?(fact)
|
149
151
|
return true if @uid.nil?
|
150
|
-
|
152
|
+
a = fact[@uid]
|
153
|
+
return true if a.nil?
|
154
|
+
@facts.include?(a[0])
|
151
155
|
end
|
152
156
|
end
|
153
157
|
end
|
data/lib/factbase.rb
CHANGED
@@ -81,7 +81,7 @@ require 'yaml'
|
|
81
81
|
# License:: MIT
|
82
82
|
class Factbase
|
83
83
|
# Current version of the gem (changed by .rultor.yml on every release)
|
84
|
-
VERSION = '0.0.
|
84
|
+
VERSION = '0.0.56'
|
85
85
|
|
86
86
|
# An exception that may be thrown in a transaction, to roll it back.
|
87
87
|
class Rollback < StandardError; end
|
data/test/factbase/test_rules.rb
CHANGED
@@ -44,6 +44,14 @@ class TestRules < Minitest::Test
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
def test_check_with_id
|
48
|
+
fb = Factbase::Rules.new(Factbase.new, '(exists foo)', uid: 'id')
|
49
|
+
fb.txn do |fbt|
|
50
|
+
f = fbt.insert
|
51
|
+
f.foo = 42
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
47
55
|
def test_to_string
|
48
56
|
fb = Factbase::Rules.new(
|
49
57
|
Factbase.new,
|