factbase 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
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 +99 -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 +3 -3
  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 +15 -4
  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 +13 -8
  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 +17 -8
  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 +16 -2
  69. data/test/factbase/test_query.rb +17 -17
  70. data/test/factbase/test_rules.rb +11 -8
  71. data/test/factbase/test_syntax.rb +29 -9
  72. data/test/factbase/test_tee.rb +18 -9
  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 +198 -18
  79. metadata +12 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da15ba272d70a23c1f7138efd317a27e19f37846c7305b005e75fb23d9222004
4
- data.tar.gz: 37588b7eb0b03659b5e6373a4f42bda9e89cd652cc954bc6a7988faf705d35ad
3
+ metadata.gz: 88beb6f254052cd02b10e5c562bf1fe940c3a488274cbab3f4fcc61ef8ede0a7
4
+ data.tar.gz: 983417ddfaf3f8b2f4930f1bb4565e4bc9d19d84ad26636df39d7bbc810ac3c1
5
5
  SHA512:
6
- metadata.gz: ba914de891e44ee3580e42be96710c3a2deecd75c2ba7fae07d78bb84920af2ffbf602b587e0aa81c1b138b9603f0c58903c21a933177e04e3fdcf1124d367b6
7
- data.tar.gz: 3c681187d0df5285eb0922f7ae718c12009c26adb84c9a9ba7ad2676c095e5dcd68e01dce538a87c52f02e3475d62e4833349995c6d69cd444f3a9730fd4ba52
6
+ metadata.gz: 577a14d1021f170224be23a8afe4427a30565c2a78356e21f582031f80a65f44e314270e1e152c4d929f7b2b92e39cecccdca1c01bb37ebb1071b77e80170288
7
+ data.tar.gz: 956b6147cf616f2376ffffd6a171b75e129f268e4c9858ba85270f2fde86e7686601f346cfbd40487f4c03562c065ce5a105a730b2b9f4e21bbd0fcc3f07113d
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 (8.0.1)
18
+ actionview (= 8.0.1)
19
+ activesupport (= 8.0.1)
20
20
  nokogiri (>= 1.8.5)
21
- racc
22
21
  rack (>= 2.2.4)
23
22
  rack-session (>= 1.0.1)
24
23
  rack-test (>= 0.6.3)
25
24
  rails-dom-testing (~> 2.2)
26
25
  rails-html-sanitizer (~> 1.6)
27
- actionview (7.1.3.4)
28
- activesupport (= 7.1.3.4)
26
+ useragent (~> 0.16)
27
+ actionview (8.0.1)
28
+ activesupport (= 8.0.1)
29
29
  builder (~> 3.1)
30
30
  erubi (~> 1.11)
31
31
  rails-dom-testing (~> 2.2)
32
32
  rails-html-sanitizer (~> 1.6)
33
- activesupport (7.1.3.4)
33
+ activesupport (8.0.1)
34
34
  base64
35
+ benchmark (>= 0.3)
35
36
  bigdecimal
36
- concurrent-ruby (~> 1.0, >= 1.0.2)
37
+ concurrent-ruby (~> 1.0, >= 1.3.1)
37
38
  connection_pool (>= 2.2.5)
38
39
  drb
39
40
  i18n (>= 1.6, < 2)
41
+ logger (>= 1.4.2)
40
42
  minitest (>= 5.1)
41
- mutex_m
42
- tzinfo (~> 2.0)
43
+ securerandom (>= 0.3)
44
+ tzinfo (~> 2.0, >= 2.0.5)
45
+ uri (>= 0.13.1)
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 (8.0.1)
118
+ actionpack (= 8.0.1)
119
+ activesupport (= 8.0.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,29 @@ 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
+ uri (1.0.2)
193
+ useragent (0.16.11)
194
+ yaml (0.4.0)
195
+ yard (0.9.37)
196
+ zeitwerk (2.7.1)
180
197
 
181
198
  PLATFORMS
182
199
  arm64-darwin-22
200
+ arm64-darwin-23
201
+ arm64-darwin-24
183
202
  x64-mingw-ucrt
184
203
  x86_64-darwin-20
185
204
  x86_64-darwin-21
@@ -187,16 +206,18 @@ PLATFORMS
187
206
 
188
207
  DEPENDENCIES
189
208
  factbase!
190
- minitest (= 5.24.1)
209
+ minitest (= 5.25.4)
191
210
  minitest-reporters (= 1.7.1)
192
211
  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)
212
+ rspec-rails (= 7.1.0)
213
+ rubocop (= 1.71.0)
214
+ rubocop-minitest (= 0.36.0)
215
+ rubocop-performance (= 1.23.1)
216
+ rubocop-rspec (= 3.4.0)
197
217
  simplecov (= 0.22.0)
198
218
  simplecov-cobertura (= 2.1.0)
199
- yard (= 0.9.36)
219
+ threads (= 0.4.1)
220
+ yard (= 0.9.37)
200
221
 
201
222
  BUNDLED WITH
202
- 2.4.22
223
+ 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.800 | Inserted 100000 facts |
189
+ | `(gt time '2024-03-23T03:21:43Z')` | 0.070 | Found 100000 fact(s) |
190
+ | `(gt cost 50)` | 0.072 | Found 49779 fact(s) |
191
+ | `(eq title 'Object Thinking 5000')` | 0.050 | Found 1 fact(s) |
192
+ | `(and (eq foo 42.998) (or (gt bar 200) (absent zzz)))` | 0.060 | Found 0 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.708 | Found 100000 fact(s) |
195
+ | `.export()` + `.import()` | 2.110 | 11407716 bytes |
196
+
197
+ The results were calculated in [this GHA job][benchmark-gha]
198
+ on 2025-01-27 at 16:25,
199
+ on Linux with 4 CPUs.
200
+ <!-- benchmark_end -->
201
+
202
+ [benchmark-gha]: https://github.com/yegor256/factbase/actions/runs/12993508174
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' \