factbase 0.4.0 → 0.5.1

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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +1 -1
  3. data/.github/workflows/actionlint.yml +1 -1
  4. data/.github/workflows/benchmark.yml +64 -0
  5. data/.github/workflows/codecov.yml +4 -2
  6. data/.github/workflows/copyrights.yml +2 -2
  7. data/.github/workflows/markdown-lint.yml +1 -1
  8. data/.github/workflows/pdd.yml +1 -1
  9. data/.github/workflows/rake.yml +2 -2
  10. data/.github/workflows/xcop.yml +1 -1
  11. data/.github/workflows/yamllint.yml +1 -1
  12. data/.gitignore +1 -1
  13. data/.rubocop.yml +6 -1
  14. data/.rultor.yml +2 -2
  15. data/.simplecov +1 -1
  16. data/.yamllint.yml +9 -4
  17. data/Gemfile +9 -7
  18. data/Gemfile.lock +98 -78
  19. data/LICENSE.txt +1 -1
  20. data/README.md +33 -0
  21. data/Rakefile +6 -1
  22. data/benchmarks/simple.rb +96 -0
  23. data/factbase.gemspec +1 -1
  24. data/lib/factbase/accum.rb +2 -2
  25. data/lib/factbase/fact.rb +6 -4
  26. data/lib/factbase/flatten.rb +2 -2
  27. data/lib/factbase/inv.rb +2 -2
  28. data/lib/factbase/looged.rb +6 -5
  29. data/lib/factbase/pre.rb +2 -2
  30. data/lib/factbase/query.rb +16 -8
  31. data/lib/factbase/query_once.rb +71 -0
  32. data/lib/factbase/rules.rb +3 -3
  33. data/lib/factbase/syntax.rb +21 -11
  34. data/lib/factbase/tee.rb +2 -2
  35. data/lib/factbase/term.rb +33 -5
  36. data/lib/factbase/term_once.rb +84 -0
  37. data/lib/factbase/terms/aggregates.rb +4 -4
  38. data/lib/factbase/terms/aliases.rb +5 -5
  39. data/lib/factbase/terms/casting.rb +2 -2
  40. data/lib/factbase/terms/debug.rb +2 -2
  41. data/lib/factbase/terms/defn.rb +2 -2
  42. data/lib/factbase/terms/logical.rb +3 -3
  43. data/lib/factbase/terms/math.rb +2 -2
  44. data/lib/factbase/terms/meta.rb +2 -2
  45. data/lib/factbase/terms/ordering.rb +2 -2
  46. data/lib/factbase/terms/strings.rb +2 -2
  47. data/lib/factbase/terms/system.rb +2 -2
  48. data/lib/factbase/to_json.rb +2 -2
  49. data/lib/factbase/to_xml.rb +2 -2
  50. data/lib/factbase/to_yaml.rb +2 -2
  51. data/lib/factbase.rb +16 -6
  52. data/test/factbase/terms/test_aggregates.rb +6 -6
  53. data/test/factbase/terms/test_aliases.rb +6 -6
  54. data/test/factbase/terms/test_casting.rb +6 -6
  55. data/test/factbase/terms/test_debug.rb +53 -0
  56. data/test/factbase/terms/test_defn.rb +15 -15
  57. data/test/factbase/terms/test_logical.rb +15 -13
  58. data/test/factbase/terms/test_math.rb +42 -42
  59. data/test/factbase/terms/test_meta.rb +87 -0
  60. data/test/factbase/terms/test_ordering.rb +45 -0
  61. data/test/factbase/terms/test_strings.rb +8 -8
  62. data/test/factbase/terms/test_system.rb +6 -6
  63. data/test/factbase/test_accum.rb +9 -9
  64. data/test/factbase/test_fact.rb +22 -22
  65. data/test/factbase/test_flatten.rb +6 -6
  66. data/test/factbase/test_inv.rb +3 -3
  67. data/test/factbase/test_looged.rb +13 -13
  68. data/test/factbase/test_pre.rb +2 -2
  69. data/test/factbase/test_query.rb +17 -17
  70. data/test/factbase/test_rules.rb +8 -8
  71. data/test/factbase/test_syntax.rb +30 -9
  72. data/test/factbase/test_tee.rb +11 -11
  73. data/test/factbase/test_term.rb +18 -18
  74. data/test/factbase/test_to_json.rb +4 -4
  75. data/test/factbase/test_to_xml.rb +12 -14
  76. data/test/factbase/test_to_yaml.rb +3 -3
  77. data/test/test__helper.rb +2 -2
  78. data/test/test_factbase.rb +200 -18
  79. metadata +12 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a78379a3da6efaffa3672290e0ec7f38f2ec5b83032719388e07b517a4fb9e99
4
- data.tar.gz: c172a777ddbb8e3799cf8e1fb55437a5172086724a8ed623ed08ff373ece7b87
3
+ metadata.gz: c672da652030c0c4a1405ce4d84b91e0ca776d342d1418be9b01d18ea6d70703
4
+ data.tar.gz: '068e446b24c80857c7c26724b22bd58d8644f8fa6db76223eb786d00fb422e1a'
5
5
  SHA512:
6
- metadata.gz: 39ee04049fe211ef67de1eee8281ced0f6c2cba9eb132d80ab10c4d0d6dc3c22dde24675a1ee5810cf0b53be9c8f1e4e8afc622873537f44179cd9251fccff9e
7
- data.tar.gz: 62390b4ef6e29ead3174f6b6a6d68d72e69cf2a35d667faf6c5aff05f310f1e42360da6917798f999a411e37894863b3956babf849d837fbc3ec4ced9306510d
6
+ metadata.gz: f3cc8aae4d769dc4103a5501d4ff8e3093dbbdb0084b3f705d0b8d4dc70667f7828ae7bc39585e68c45891c94a926828e899110e34f3a76aad918e8acf9f319c
7
+ data.tar.gz: 062e0dc1dd5f90e5d9555baa2f2d79f957180d2a1c823a35bb296db43708d9feacb9f9b1465c0bfc411245aeba981dee0a902d22c806febf99f6676911354a7d
data/.0pdd.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024-2025 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+ ---
23
+ name: benchmark
24
+ 'on':
25
+ push:
26
+ paths-ignore: [ 'README.md', '.github/**' ]
27
+ concurrency:
28
+ group: benchmark-${{ github.ref }}
29
+ cancel-in-progress: true
30
+ jobs:
31
+ benchmark:
32
+ runs-on: ubuntu-24.04
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: '3.1'
38
+ - run: |
39
+ gem install bundler
40
+ bundle install
41
+ - run: ruby benchmarks/simple.rb > stdout.txt
42
+ - run: |
43
+ set -x
44
+ sum=$(
45
+ cat stdout.txt
46
+ echo
47
+ echo "The results were calculated in [this GHA job][benchmark-gha]"
48
+ echo "on $(date +'%Y-%m-%d') at $(date +'%H:%M'),"
49
+ echo "on $(uname) with $(nproc --all) CPUs."
50
+ )
51
+ export sum
52
+ perl -i -0777 -pe 's/(?<=<!-- benchmark_begin -->).*(?=<!-- benchmark_end -->)/\n$ENV{sum}\n/gs;' README.md
53
+ url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}
54
+ export url
55
+ perl -i -0777 -pe 's/(?<=\[benchmark-gha\]: )[^\n]+(?=\n)/$ENV{url}/gs;' README.md
56
+ rm stdout.txt
57
+ - uses: peter-evans/create-pull-request@v7
58
+ with:
59
+ branch: benchmark-results
60
+ commit-message: 'new benchmarking results'
61
+ delete-branch: true
62
+ title: 'New Benchmarking Results'
63
+ reviewers: yegor256
64
+ base: master
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -34,6 +34,8 @@ jobs:
34
34
  bundler-cache: true
35
35
  - run: bundle install
36
36
  - run: bundle exec rake
37
- - uses: codecov/codecov-action@v4.0.0-beta.3
37
+ - uses: codecov/codecov-action@v5
38
38
  with:
39
39
  token: ${{ secrets.CODECOV_TOKEN }}
40
+ files: coverage/.resultset.json
41
+ fail_ci_if_error: true
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -31,4 +31,4 @@ jobs:
31
31
  runs-on: ubuntu-24.04
32
32
  steps:
33
33
  - uses: actions/checkout@v4
34
- - uses: yegor256/copyrights-action@0.0.5
34
+ - uses: yegor256/copyrights-action@0.0.8
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -31,7 +31,7 @@ jobs:
31
31
  name: test
32
32
  strategy:
33
33
  matrix:
34
- os: [ubuntu-24.04, macos-12, windows-2022]
34
+ os: [ubuntu-24.04, macos-15, windows-2022]
35
35
  ruby: [3.3]
36
36
  runs-on: ${{ matrix.os }}
37
37
  steps:
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
data/.gitignore CHANGED
@@ -5,4 +5,4 @@ coverage/
5
5
  .DS_Store
6
6
  rdoc/
7
7
  doc/
8
- .yardoc/
8
+ .yardoc/
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +27,12 @@ AllCops:
27
27
  TargetRubyVersion: 3.2
28
28
  SuggestExtensions: false
29
29
  NewCops: enable
30
+ require:
31
+ - rubocop-minitest
32
+ - rubocop-performance
30
33
 
34
+ Minitest/EmptyLineBeforeAssertionMethods:
35
+ Enabled: false
31
36
  Gemspec/RequiredRubyVersion:
32
37
  Enabled: false
33
38
  Metrics/MethodLength:
data/.rultor.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -19,7 +19,7 @@
19
19
  # SOFTWARE.
20
20
  ---
21
21
  docker:
22
- image: yegor256/rultor-image:1.23.1
22
+ image: yegor256/rultor-ruby
23
23
  assets:
24
24
  rubygems.yml: yegor256/home#assets/rubygems.yml
25
25
  install: |
data/.simplecov CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2024 Yegor Bugayenko
4
+ # Copyright (c) 2024-2025 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
data/.yamllint.yml CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2024 Yegor Bugayenko
1
+ # Copyright (c) 2024-2025 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -18,7 +18,12 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
19
  # SOFTWARE.
20
20
  ---
21
+ extends: default
21
22
  rules:
22
- line-length:
23
- max: 80
24
- allow-non-breakable-words: true
23
+ line-length: disable
24
+ brackets:
25
+ min-spaces-inside: 0
26
+ max-spaces-inside: 2
27
+ truthy:
28
+ level: warning
29
+ allowed-values: [ 'on', 'true', 'false', 'yes', 'no' ]
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024 Yegor Bugayenko
3
+ # Copyright (c) 2024-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -23,13 +23,15 @@
23
23
  source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
- gem 'minitest', '5.24.1', require: false
26
+ gem 'minitest', '5.25.4', require: false
27
27
  gem 'minitest-reporters', '1.7.1', require: false
28
28
  gem 'rake', '13.2.1', require: false
29
- gem 'rspec-rails', '6.1.3', require: false
30
- gem 'rubocop', '1.65.1', require: false
31
- gem 'rubocop-performance', '1.21.1', require: false
32
- gem 'rubocop-rspec', '3.0.4', require: false
29
+ gem 'rspec-rails', '7.1.0', require: false
30
+ gem 'rubocop', '1.71.0', require: false
31
+ gem 'rubocop-minitest', '0.36.0', require: false
32
+ gem 'rubocop-performance', '1.23.1', require: false
33
+ gem 'rubocop-rspec', '3.4.0', require: false
33
34
  gem 'simplecov', '0.22.0', require: false
34
35
  gem 'simplecov-cobertura', '2.1.0', require: false
35
- gem 'yard', '0.9.36', require: false
36
+ gem 'threads', '0.4.1', require: false
37
+ gem 'yard', '0.9.37', require: false
data/Gemfile.lock CHANGED
@@ -14,149 +14,161 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- actionpack (7.1.3.4)
18
- actionview (= 7.1.3.4)
19
- activesupport (= 7.1.3.4)
17
+ actionpack (7.2.2.1)
18
+ actionview (= 7.2.2.1)
19
+ activesupport (= 7.2.2.1)
20
20
  nokogiri (>= 1.8.5)
21
21
  racc
22
- rack (>= 2.2.4)
22
+ rack (>= 2.2.4, < 3.2)
23
23
  rack-session (>= 1.0.1)
24
24
  rack-test (>= 0.6.3)
25
25
  rails-dom-testing (~> 2.2)
26
26
  rails-html-sanitizer (~> 1.6)
27
- actionview (7.1.3.4)
28
- activesupport (= 7.1.3.4)
27
+ useragent (~> 0.16)
28
+ actionview (7.2.2.1)
29
+ activesupport (= 7.2.2.1)
29
30
  builder (~> 3.1)
30
31
  erubi (~> 1.11)
31
32
  rails-dom-testing (~> 2.2)
32
33
  rails-html-sanitizer (~> 1.6)
33
- activesupport (7.1.3.4)
34
+ activesupport (7.2.2.1)
34
35
  base64
36
+ benchmark (>= 0.3)
35
37
  bigdecimal
36
- concurrent-ruby (~> 1.0, >= 1.0.2)
38
+ concurrent-ruby (~> 1.0, >= 1.3.1)
37
39
  connection_pool (>= 2.2.5)
38
40
  drb
39
41
  i18n (>= 1.6, < 2)
42
+ logger (>= 1.4.2)
40
43
  minitest (>= 5.1)
41
- mutex_m
42
- tzinfo (~> 2.0)
44
+ securerandom (>= 0.3)
45
+ tzinfo (~> 2.0, >= 2.0.5)
43
46
  ansi (1.5.0)
44
47
  ast (2.4.2)
45
48
  backtrace (0.4.0)
46
49
  base64 (0.2.0)
47
- bigdecimal (3.1.8)
50
+ benchmark (0.4.0)
51
+ bigdecimal (3.1.9)
48
52
  builder (3.3.0)
49
- concurrent-ruby (1.3.3)
50
- connection_pool (2.4.1)
53
+ concurrent-ruby (1.3.5)
54
+ connection_pool (2.5.0)
51
55
  crass (1.0.6)
56
+ date (3.4.1)
52
57
  decoor (0.0.1)
53
58
  diff-lcs (1.5.1)
54
59
  docile (1.4.1)
55
60
  drb (2.2.1)
56
- erubi (1.13.0)
57
- i18n (1.14.5)
61
+ erubi (1.13.1)
62
+ i18n (1.14.7)
58
63
  concurrent-ruby (~> 1.0)
59
- io-console (0.7.2)
60
- irb (1.14.0)
64
+ io-console (0.8.0)
65
+ irb (1.15.1)
66
+ pp (>= 0.6.0)
61
67
  rdoc (>= 4.0.0)
62
68
  reline (>= 0.4.2)
63
- json (2.7.2)
64
- language_server-protocol (3.17.0.3)
65
- loofah (2.22.0)
69
+ json (2.9.1)
70
+ language_server-protocol (3.17.0.4)
71
+ logger (1.6.5)
72
+ loofah (2.24.0)
66
73
  crass (~> 1.0.2)
67
74
  nokogiri (>= 1.12.0)
68
- loog (0.5.3)
69
- minitest (5.24.1)
75
+ loog (0.6.0)
76
+ minitest (5.25.4)
70
77
  minitest-reporters (1.7.1)
71
78
  ansi
72
79
  builder
73
80
  minitest (>= 5.0)
74
81
  ruby-progressbar
75
- mutex_m (0.2.0)
76
- nokogiri (1.16.7-arm64-darwin)
82
+ nokogiri (1.18.2-arm64-darwin)
77
83
  racc (~> 1.4)
78
- nokogiri (1.16.7-x64-mingw-ucrt)
84
+ nokogiri (1.18.2-x64-mingw-ucrt)
79
85
  racc (~> 1.4)
80
- nokogiri (1.16.7-x86_64-darwin)
86
+ nokogiri (1.18.2-x86_64-darwin)
81
87
  racc (~> 1.4)
82
- nokogiri (1.16.7-x86_64-linux)
88
+ nokogiri (1.18.2-x86_64-linux-gnu)
83
89
  racc (~> 1.4)
84
90
  others (0.0.3)
85
- parallel (1.25.1)
86
- parser (3.3.4.0)
91
+ parallel (1.26.3)
92
+ parser (3.3.7.0)
87
93
  ast (~> 2.4.1)
88
94
  racc
89
- psych (5.1.2)
95
+ pp (0.6.2)
96
+ prettyprint
97
+ prettyprint (0.2.0)
98
+ psych (5.2.3)
99
+ date
90
100
  stringio
91
101
  racc (1.8.1)
92
- rack (3.1.7)
93
- rack-session (2.0.0)
102
+ rack (3.1.8)
103
+ rack-session (2.1.0)
104
+ base64 (>= 0.1.0)
94
105
  rack (>= 3.0.0)
95
- rack-test (2.1.0)
106
+ rack-test (2.2.0)
96
107
  rack (>= 1.3)
97
- rackup (2.1.0)
108
+ rackup (2.2.1)
98
109
  rack (>= 3)
99
- webrick (~> 1.8)
100
110
  rails-dom-testing (2.2.0)
101
111
  activesupport (>= 5.0.0)
102
112
  minitest
103
113
  nokogiri (>= 1.6)
104
- rails-html-sanitizer (1.6.0)
114
+ rails-html-sanitizer (1.6.2)
105
115
  loofah (~> 2.21)
106
- nokogiri (~> 1.14)
107
- railties (7.1.3.4)
108
- actionpack (= 7.1.3.4)
109
- activesupport (= 7.1.3.4)
110
- irb
116
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
117
+ railties (7.2.2.1)
118
+ actionpack (= 7.2.2.1)
119
+ activesupport (= 7.2.2.1)
120
+ irb (~> 1.13)
111
121
  rackup (>= 1.0.0)
112
122
  rake (>= 12.2)
113
123
  thor (~> 1.0, >= 1.2.2)
114
124
  zeitwerk (~> 2.6)
115
125
  rainbow (3.1.1)
116
126
  rake (13.2.1)
117
- rdoc (6.7.0)
127
+ rdoc (6.11.0)
118
128
  psych (>= 4.0.0)
119
- regexp_parser (2.9.2)
120
- reline (0.5.9)
129
+ regexp_parser (2.10.0)
130
+ reline (0.6.0)
121
131
  io-console (~> 0.5)
122
- rexml (3.3.4)
123
- strscan
124
- rspec-core (3.13.0)
132
+ rexml (3.4.0)
133
+ rspec-core (3.13.2)
125
134
  rspec-support (~> 3.13.0)
126
- rspec-expectations (3.13.1)
135
+ rspec-expectations (3.13.3)
127
136
  diff-lcs (>= 1.2.0, < 2.0)
128
137
  rspec-support (~> 3.13.0)
129
- rspec-mocks (3.13.1)
138
+ rspec-mocks (3.13.2)
130
139
  diff-lcs (>= 1.2.0, < 2.0)
131
140
  rspec-support (~> 3.13.0)
132
- rspec-rails (6.1.3)
133
- actionpack (>= 6.1)
134
- activesupport (>= 6.1)
135
- railties (>= 6.1)
141
+ rspec-rails (7.1.0)
142
+ actionpack (>= 7.0)
143
+ activesupport (>= 7.0)
144
+ railties (>= 7.0)
136
145
  rspec-core (~> 3.13)
137
146
  rspec-expectations (~> 3.13)
138
147
  rspec-mocks (~> 3.13)
139
148
  rspec-support (~> 3.13)
140
- rspec-support (3.13.1)
141
- rubocop (1.65.1)
149
+ rspec-support (3.13.2)
150
+ rubocop (1.71.0)
142
151
  json (~> 2.3)
143
152
  language_server-protocol (>= 3.17.0)
144
153
  parallel (~> 1.10)
145
154
  parser (>= 3.3.0.2)
146
155
  rainbow (>= 2.2.2, < 4.0)
147
- regexp_parser (>= 2.4, < 3.0)
148
- rexml (>= 3.2.5, < 4.0)
149
- rubocop-ast (>= 1.31.1, < 2.0)
156
+ regexp_parser (>= 2.9.3, < 3.0)
157
+ rubocop-ast (>= 1.36.2, < 2.0)
150
158
  ruby-progressbar (~> 1.7)
151
- unicode-display_width (>= 2.4.0, < 3.0)
152
- rubocop-ast (1.31.3)
159
+ unicode-display_width (>= 2.4.0, < 4.0)
160
+ rubocop-ast (1.37.0)
153
161
  parser (>= 3.3.1.0)
154
- rubocop-performance (1.21.1)
162
+ rubocop-minitest (0.36.0)
163
+ rubocop (>= 1.61, < 2.0)
164
+ rubocop-ast (>= 1.31.1, < 2.0)
165
+ rubocop-performance (1.23.1)
155
166
  rubocop (>= 1.48.1, < 2.0)
156
167
  rubocop-ast (>= 1.31.1, < 2.0)
157
- rubocop-rspec (3.0.4)
168
+ rubocop-rspec (3.4.0)
158
169
  rubocop (~> 1.61)
159
170
  ruby-progressbar (1.13.0)
171
+ securerandom (0.4.1)
160
172
  simplecov (0.22.0)
161
173
  docile (~> 1.1)
162
174
  simplecov-html (~> 0.11)
@@ -164,22 +176,28 @@ GEM
164
176
  simplecov-cobertura (2.1.0)
165
177
  rexml
166
178
  simplecov (~> 0.19)
167
- simplecov-html (0.12.3)
179
+ simplecov-html (0.13.1)
168
180
  simplecov_json_formatter (0.1.4)
169
- stringio (3.1.1)
170
- strscan (3.1.0)
181
+ stringio (3.1.2)
171
182
  tago (0.0.2)
172
- thor (1.3.1)
183
+ thor (1.3.2)
184
+ threads (0.4.1)
185
+ backtrace (~> 0)
186
+ concurrent-ruby (~> 1.0)
173
187
  tzinfo (2.0.6)
174
188
  concurrent-ruby (~> 1.0)
175
- unicode-display_width (2.5.0)
176
- webrick (1.8.1)
177
- yaml (0.3.0)
178
- yard (0.9.36)
179
- zeitwerk (2.6.17)
189
+ unicode-display_width (3.1.4)
190
+ unicode-emoji (~> 4.0, >= 4.0.4)
191
+ unicode-emoji (4.0.4)
192
+ useragent (0.16.11)
193
+ yaml (0.4.0)
194
+ yard (0.9.37)
195
+ zeitwerk (2.6.18)
180
196
 
181
197
  PLATFORMS
182
198
  arm64-darwin-22
199
+ arm64-darwin-23
200
+ arm64-darwin-24
183
201
  x64-mingw-ucrt
184
202
  x86_64-darwin-20
185
203
  x86_64-darwin-21
@@ -187,16 +205,18 @@ PLATFORMS
187
205
 
188
206
  DEPENDENCIES
189
207
  factbase!
190
- minitest (= 5.24.1)
208
+ minitest (= 5.25.4)
191
209
  minitest-reporters (= 1.7.1)
192
210
  rake (= 13.2.1)
193
- rspec-rails (= 6.1.3)
194
- rubocop (= 1.65.1)
195
- rubocop-performance (= 1.21.1)
196
- rubocop-rspec (= 3.0.4)
211
+ rspec-rails (= 7.1.0)
212
+ rubocop (= 1.71.0)
213
+ rubocop-minitest (= 0.36.0)
214
+ rubocop-performance (= 1.23.1)
215
+ rubocop-rspec (= 3.4.0)
197
216
  simplecov (= 0.22.0)
198
217
  simplecov-cobertura (= 2.1.0)
199
- yard (= 0.9.36)
218
+ threads (= 0.4.1)
219
+ yard (= 0.9.37)
200
220
 
201
221
  BUNDLED WITH
202
- 2.4.22
222
+ 2.5.16
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2024 Yegor Bugayenko
3
+ Copyright (c) 2024-2025 Yegor Bugayenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the 'Software'), to deal
data/README.md CHANGED
@@ -54,6 +54,16 @@ f2.import(File.read(file))
54
54
  assert(f2.query('(eq foo 42)').each.to_a.size == 1)
55
55
  ```
56
56
 
57
+ You can check the presence of an attribute by name and then
58
+ set it, also by name:
59
+
60
+ ```ruby
61
+ n = 'foo'
62
+ if f[n].nil?
63
+ f.send("#{n}=", 'Hello, world!')
64
+ end
65
+ ```
66
+
57
67
  There are some boolean terms available in a query
58
68
  (they return either `true` or `false`):
59
69
 
@@ -167,3 +177,26 @@ bundle exec rake
167
177
  ```
168
178
 
169
179
  If it's clean and you don't see any error messages, submit your pull request.
180
+
181
+ ## Benchmark
182
+
183
+ This is the result of the benchmark:
184
+
185
+ <!-- benchmark_begin -->
186
+ | Action | Seconds | Details |
187
+ | --- | --: | --- |
188
+ | `fb.insert()` | 7.874 | Inserted 100000 facts |
189
+ | `(gt time '2024-03-23T03:21:43Z')` | 0.072 | Found 100000 fact(s) |
190
+ | `(gt cost 50)` | 0.069 | Found 50030 fact(s) |
191
+ | `(eq title 'Object Thinking 5000')` | 0.051 | Found 1 fact(s) |
192
+ | `(and (eq foo 42.998) (or (gt bar 200) (absent zzz)))` | 0.059 | Found 2 fact(s) |
193
+ | `(eq id (agg (always) (max id)))` | 0.131 | Found 1 fact(s) |
194
+ | `(join "c<=cost,b<=bar" (eq id (agg (always) (max id))))` | 0.695 | Found 100000 fact(s) |
195
+ | `.export()` + `.import()` | 1.931 | 11407636 bytes |
196
+
197
+ The results were calculated in [this GHA job][benchmark-gha]
198
+ on 2025-01-27 at 16:51,
199
+ on Linux with 4 CPUs.
200
+ <!-- benchmark_end -->
201
+
202
+ [benchmark-gha]: https://github.com/yegor256/factbase/actions/runs/12994018323
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2024 Yegor Bugayenko
3
+ # Copyright (c) 2024-2025 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -57,6 +57,11 @@ RuboCop::RakeTask.new(:rubocop) do |task|
57
57
  task.requires << 'rubocop-rspec'
58
58
  end
59
59
 
60
+ desc 'Run benchmark script'
61
+ task :benchmark do
62
+ ruby 'benchmarks/simple.rb'
63
+ end
64
+
60
65
  task :copyright do
61
66
  sh "grep -q -r '#{Date.today.strftime('%Y')}' \
62
67
  --include '*.rb' \