factbase 0.10.0 → 0.10.2
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/.github/workflows/benchmark.yml +1 -0
- data/.github/workflows/typos.yml +19 -0
- data/.gitignore +2 -2
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +16 -15
- data/REUSE.toml +8 -7
- data/lib/factbase/cached/cached_fact.rb +4 -0
- data/lib/factbase/cached/cached_factbase.rb +2 -2
- data/lib/factbase/indexed/indexed_fact.rb +4 -0
- data/lib/factbase/indexed/indexed_factbase.rb +2 -2
- data/lib/factbase/taped.rb +5 -2
- data/lib/factbase.rb +1 -1
- data/test/factbase/test_query.rb +1 -1
- data/test/test_factbase.rb +12 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fd3c455b06a6b4ef8b25495c251b040b32ad8bbffd668452ba0ea5aac492cd5
|
4
|
+
data.tar.gz: c90678471389952b279788986431ae1a760aeadfac1de3dca398f83cac411c24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92491db37e79d3585c42c77be9b34ba3fa571d7b2edb2013d3b400946789a8affa01c189b62908a4dc6f98e29446b1175dded6378f18e6efcdc1a9c875294a91
|
7
|
+
data.tar.gz: 56a04945eff49360290f349dd110f504dddd1708ad1b6708097c402a5403ba7984b7a59c29ee3cb6525bdeec61b73e90028fa11d65d660fe777bcaa80bfbbd20
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
---
|
4
|
+
# yamllint disable rule:line-length
|
5
|
+
name: typos
|
6
|
+
'on':
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
pull_request:
|
11
|
+
branches:
|
12
|
+
- master
|
13
|
+
jobs:
|
14
|
+
typos:
|
15
|
+
timeout-minutes: 15
|
16
|
+
runs-on: ubuntu-24.04
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
- uses: crate-ci/typos@v1.32.0
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -26,36 +26,37 @@ GEM
|
|
26
26
|
elapsed (0.0.1)
|
27
27
|
loog (> 0)
|
28
28
|
tago (> 0)
|
29
|
-
json (2.
|
30
|
-
language_server-protocol (3.17.0.
|
29
|
+
json (2.12.0)
|
30
|
+
language_server-protocol (3.17.0.5)
|
31
31
|
lint_roller (1.1.0)
|
32
32
|
logger (1.7.0)
|
33
|
-
loog (0.6.
|
33
|
+
loog (0.6.1)
|
34
|
+
logger (~> 1.0)
|
34
35
|
minitest (5.25.5)
|
35
36
|
minitest-reporters (1.7.1)
|
36
37
|
ansi
|
37
38
|
builder
|
38
39
|
minitest (>= 5.0)
|
39
40
|
ruby-progressbar
|
40
|
-
nokogiri (1.18.
|
41
|
+
nokogiri (1.18.8-arm64-darwin)
|
41
42
|
racc (~> 1.4)
|
42
|
-
nokogiri (1.18.
|
43
|
+
nokogiri (1.18.8-x64-mingw-ucrt)
|
43
44
|
racc (~> 1.4)
|
44
|
-
nokogiri (1.18.
|
45
|
+
nokogiri (1.18.8-x86_64-darwin)
|
45
46
|
racc (~> 1.4)
|
46
|
-
nokogiri (1.18.
|
47
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
47
48
|
racc (~> 1.4)
|
48
49
|
os (1.1.4)
|
49
50
|
others (0.0.3)
|
50
|
-
parallel (1.
|
51
|
-
parser (3.3.
|
51
|
+
parallel (1.27.0)
|
52
|
+
parser (3.3.8.0)
|
52
53
|
ast (~> 2.4.1)
|
53
54
|
racc
|
54
55
|
prism (1.4.0)
|
55
|
-
psych (5.2.
|
56
|
+
psych (5.2.6)
|
56
57
|
date
|
57
58
|
stringio
|
58
|
-
qbash (0.4.
|
59
|
+
qbash (0.4.5)
|
59
60
|
backtrace (> 0)
|
60
61
|
elapsed (> 0)
|
61
62
|
loog (> 0)
|
@@ -67,7 +68,7 @@ GEM
|
|
67
68
|
psych (>= 4.0.0)
|
68
69
|
regexp_parser (2.10.0)
|
69
70
|
rexml (3.4.1)
|
70
|
-
rubocop (1.75.
|
71
|
+
rubocop (1.75.6)
|
71
72
|
json (~> 2.3)
|
72
73
|
language_server-protocol (~> 3.17.0.2)
|
73
74
|
lint_roller (~> 1.1.0)
|
@@ -78,7 +79,7 @@ GEM
|
|
78
79
|
rubocop-ast (>= 1.44.0, < 2.0)
|
79
80
|
ruby-progressbar (~> 1.7)
|
80
81
|
unicode-display_width (>= 2.4.0, < 4.0)
|
81
|
-
rubocop-ast (1.44.
|
82
|
+
rubocop-ast (1.44.1)
|
82
83
|
parser (>= 3.3.7.2)
|
83
84
|
prism (~> 1.4)
|
84
85
|
rubocop-minitest (0.38.0)
|
@@ -92,7 +93,7 @@ GEM
|
|
92
93
|
rubocop-rake (0.7.1)
|
93
94
|
lint_roller (~> 1.1)
|
94
95
|
rubocop (>= 1.72.1)
|
95
|
-
rubocop-rspec (3.
|
96
|
+
rubocop-rspec (3.6.0)
|
96
97
|
lint_roller (~> 1.1)
|
97
98
|
rubocop (~> 1.72, >= 1.72.1)
|
98
99
|
ruby-progressbar (1.13.0)
|
@@ -105,7 +106,7 @@ GEM
|
|
105
106
|
simplecov (~> 0.19)
|
106
107
|
simplecov-html (0.13.1)
|
107
108
|
simplecov_json_formatter (0.1.4)
|
108
|
-
stringio (3.1.
|
109
|
+
stringio (3.1.7)
|
109
110
|
tago (0.1.0)
|
110
111
|
threads (0.4.1)
|
111
112
|
backtrace (~> 0)
|
data/REUSE.toml
CHANGED
@@ -4,9 +4,17 @@
|
|
4
4
|
version = 1
|
5
5
|
[[annotations]]
|
6
6
|
path = [
|
7
|
+
".DS_Store",
|
8
|
+
".gitattributes",
|
9
|
+
".gitignore",
|
10
|
+
".pdd",
|
7
11
|
"**.json",
|
8
12
|
"**.md",
|
13
|
+
"**.png",
|
9
14
|
"**.txt",
|
15
|
+
"**/.DS_Store",
|
16
|
+
"**/.gitignore",
|
17
|
+
"**/.pdd",
|
10
18
|
"**/*.csv",
|
11
19
|
"**/*.jpg",
|
12
20
|
"**/*.json",
|
@@ -16,15 +24,8 @@ path = [
|
|
16
24
|
"**/*.svg",
|
17
25
|
"**/*.txt",
|
18
26
|
"**/*.vm",
|
19
|
-
"**/.DS_Store",
|
20
|
-
"**/.gitignore",
|
21
|
-
"**/.pdd",
|
22
27
|
"**/CNAME",
|
23
28
|
"**/Gemfile.lock",
|
24
|
-
".DS_Store",
|
25
|
-
".gitattributes",
|
26
|
-
".gitignore",
|
27
|
-
".pdd",
|
28
29
|
"Gemfile.lock",
|
29
30
|
"README.md",
|
30
31
|
"renovate.json",
|
@@ -22,9 +22,9 @@ class Factbase::CachedFactbase
|
|
22
22
|
# @param [Factbase] origin Original factbase to decorate
|
23
23
|
# @param [Hash] cache Cache to use
|
24
24
|
def initialize(origin, cache = {})
|
25
|
-
raise '
|
25
|
+
raise 'Wrong type of original' unless origin.respond_to?(:query)
|
26
26
|
@origin = origin
|
27
|
-
raise '
|
27
|
+
raise 'Wrong type of cache' unless cache.is_a?(Hash)
|
28
28
|
@cache = cache
|
29
29
|
end
|
30
30
|
|
@@ -22,9 +22,9 @@ class Factbase::IndexedFactbase
|
|
22
22
|
# @param [Factbase] origin Original factbase to decorate
|
23
23
|
# @param [Hash] idx Index to use
|
24
24
|
def initialize(origin, idx = {})
|
25
|
-
raise '
|
25
|
+
raise 'Wrong type of original' unless origin.respond_to?(:query)
|
26
26
|
@origin = origin
|
27
|
-
raise '
|
27
|
+
raise 'Wrong type of index' unless idx.is_a?(Hash)
|
28
28
|
@idx = idx
|
29
29
|
end
|
30
30
|
|
data/lib/factbase/taped.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
4
4
|
# SPDX-License-Identifier: MIT
|
5
5
|
|
6
|
+
require 'decoor'
|
6
7
|
require_relative '../factbase'
|
7
8
|
|
8
9
|
# A decorator of an Array with HashMaps, that records facts that have been touched,
|
@@ -44,7 +45,7 @@ class Factbase::Taped
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def <<(map)
|
47
|
-
@origin <<
|
48
|
+
@origin << map
|
48
49
|
@inserted.append(map.object_id)
|
49
50
|
end
|
50
51
|
|
@@ -82,6 +83,8 @@ class Factbase::Taped
|
|
82
83
|
|
83
84
|
# Decorator of Hash.
|
84
85
|
class TapedHash
|
86
|
+
decoor(:origin)
|
87
|
+
|
85
88
|
def initialize(origin, added)
|
86
89
|
@origin = origin
|
87
90
|
@added = added
|
@@ -134,7 +137,7 @@ class Factbase::Taped
|
|
134
137
|
|
135
138
|
def <<(item)
|
136
139
|
@added.append(@oid)
|
137
|
-
@origin <<
|
140
|
+
@origin << item
|
138
141
|
end
|
139
142
|
|
140
143
|
def uniq!
|
data/lib/factbase.rb
CHANGED
@@ -82,7 +82,7 @@ require 'yaml'
|
|
82
82
|
# License:: MIT
|
83
83
|
class Factbase
|
84
84
|
# Current version of the gem (changed by .rultor.yml on every release)
|
85
|
-
VERSION = '0.10.
|
85
|
+
VERSION = '0.10.2' unless const_defined?(:VERSION)
|
86
86
|
|
87
87
|
# An exception that may be thrown in a transaction, to roll it back.
|
88
88
|
class Rollback < StandardError; end
|
data/test/factbase/test_query.rb
CHANGED
@@ -197,7 +197,7 @@ class TestQuery < Factbase::Test
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
-
def
|
200
|
+
def test_finds_with_substitution
|
201
201
|
maps = [{ 'foo' => [42] }, { 'bar' => [7] }, { 'foo' => [666] }]
|
202
202
|
with_factbases(maps) do |badge, fb|
|
203
203
|
assert_equal(0, fb.query('(eq 2 (agg (eq foo $foo) (count)))').each.to_a.size, "with #{badge}")
|
data/test/test_factbase.rb
CHANGED
@@ -485,4 +485,16 @@ class TestFactbase < Factbase::Test
|
|
485
485
|
end
|
486
486
|
assert_equal(1, fb.size)
|
487
487
|
end
|
488
|
+
|
489
|
+
def test_get_raise_for_empty_fact
|
490
|
+
fb = Factbase.new
|
491
|
+
fb.txn do |fbt|
|
492
|
+
f = fbt.insert
|
493
|
+
f.foo = 123
|
494
|
+
f = fbt.query('(always)').each.to_a.first
|
495
|
+
assert_equal(123, f.foo)
|
496
|
+
ex = assert_raises(RuntimeError) { f.bar }
|
497
|
+
assert_equal("Can't find 'bar' attribute out of [foo]", ex.message)
|
498
|
+
end
|
499
|
+
end
|
488
500
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: backtrace
|
@@ -144,8 +144,8 @@ email: yegor256@gmail.com
|
|
144
144
|
executables: []
|
145
145
|
extensions: []
|
146
146
|
extra_rdoc_files:
|
147
|
-
- README.md
|
148
147
|
- LICENSE.txt
|
148
|
+
- README.md
|
149
149
|
files:
|
150
150
|
- ".0pdd.yml"
|
151
151
|
- ".gitattributes"
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- ".github/workflows/pdd.yml"
|
158
158
|
- ".github/workflows/rake.yml"
|
159
159
|
- ".github/workflows/reuse.yml"
|
160
|
+
- ".github/workflows/typos.yml"
|
160
161
|
- ".github/workflows/xcop.yml"
|
161
162
|
- ".github/workflows/yamllint.yml"
|
162
163
|
- ".gitignore"
|
@@ -291,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
292
|
- !ruby/object:Gem::Version
|
292
293
|
version: '0'
|
293
294
|
requirements: []
|
294
|
-
rubygems_version: 3.6.
|
295
|
+
rubygems_version: 3.6.7
|
295
296
|
specification_version: 4
|
296
297
|
summary: Factbase
|
297
298
|
test_files: []
|