factbase 0.16.7 → 0.16.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/lib/factbase/query.rb +20 -8
- data/lib/factbase/version.rb +1 -1
- 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: '0156369b495c6ca1f2ef02f8154f9f639c710e01ac481d230781dc8eecd96e63'
|
4
|
+
data.tar.gz: 7b90b7b1efdc0128a73287becca34609b57e1779089312fe8367064a8bfff10b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bab2eb3a28c5d26d5815c89f75331205dbcb164cd94c833cbb1c1e5a7eed7903f7d51953be249b49224970221c95d24ecf465592b01a8ebae12d871518dcb759
|
7
|
+
data.tar.gz: 5a20d5698d0757c8a33e1de0a044a4567c19e44e5f52a4be21982d52389cfb058933fa14b7ef81da03ec7c671241e629f057caf9c6f3e118d379a04d5741b887
|
data/Gemfile.lock
CHANGED
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
tago (~> 0.1)
|
30
30
|
ellipsized (0.3.0)
|
31
31
|
erb (5.0.2)
|
32
|
-
json (2.
|
32
|
+
json (2.15.0)
|
33
33
|
language_server-protocol (3.17.0.5)
|
34
34
|
lint_roller (1.1.0)
|
35
35
|
logger (1.7.0)
|
@@ -70,9 +70,9 @@ GEM
|
|
70
70
|
rdoc (6.14.2)
|
71
71
|
erb
|
72
72
|
psych (>= 4.0.0)
|
73
|
-
regexp_parser (2.11.
|
73
|
+
regexp_parser (2.11.3)
|
74
74
|
rexml (3.4.4)
|
75
|
-
rubocop (1.
|
75
|
+
rubocop (1.81.1)
|
76
76
|
json (~> 2.3)
|
77
77
|
language_server-protocol (~> 3.17.0.2)
|
78
78
|
lint_roller (~> 1.1.0)
|
@@ -80,10 +80,10 @@ GEM
|
|
80
80
|
parser (>= 3.3.0.2)
|
81
81
|
rainbow (>= 2.2.2, < 4.0)
|
82
82
|
regexp_parser (>= 2.9.3, < 3.0)
|
83
|
-
rubocop-ast (>= 1.
|
83
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
84
84
|
ruby-progressbar (~> 1.7)
|
85
85
|
unicode-display_width (>= 2.4.0, < 4.0)
|
86
|
-
rubocop-ast (1.
|
86
|
+
rubocop-ast (1.47.1)
|
87
87
|
parser (>= 3.3.7.2)
|
88
88
|
prism (~> 1.4)
|
89
89
|
rubocop-minitest (0.38.2)
|
data/lib/factbase/query.rb
CHANGED
@@ -77,17 +77,29 @@ class Factbase::Query
|
|
77
77
|
|
78
78
|
# Delete all facts that match the query.
|
79
79
|
# @param [Factbase] fb The factbase to delete from
|
80
|
+
# @param [id] String The id of facts that uniquely identify them
|
80
81
|
# @return [Integer] Total number of facts deleted
|
81
|
-
def delete!(fb = @fb)
|
82
|
+
def delete!(fb = @fb, id: '_id')
|
82
83
|
deleted = 0
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
false
|
84
|
+
ids = []
|
85
|
+
each(fb) do |f|
|
86
|
+
i = f[id]
|
87
|
+
unless i
|
88
|
+
ids = nil
|
89
|
+
break
|
90
90
|
end
|
91
|
+
ids << i.first
|
92
|
+
end
|
93
|
+
@maps.delete_if do |m|
|
94
|
+
d =
|
95
|
+
if ids
|
96
|
+
i = m[id]&.first
|
97
|
+
i && ids.include?(i)
|
98
|
+
else
|
99
|
+
@term.evaluate(Factbase::Fact.new(m), @maps, fb)
|
100
|
+
end
|
101
|
+
deleted += 1 if d
|
102
|
+
d
|
91
103
|
end
|
92
104
|
deleted
|
93
105
|
end
|
data/lib/factbase/version.rb
CHANGED