mongory 0.7.2-x86_64-linux

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 (115) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +88 -0
  4. data/.yardopts +7 -0
  5. data/CHANGELOG.md +364 -0
  6. data/CODE_OF_CONDUCT.md +84 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +488 -0
  9. data/Rakefile +107 -0
  10. data/SUBMODULE_INTEGRATION.md +325 -0
  11. data/docs/advanced_usage.md +40 -0
  12. data/docs/clang_bridge.md +69 -0
  13. data/docs/field_names.md +30 -0
  14. data/docs/migration.md +30 -0
  15. data/docs/performance.md +61 -0
  16. data/examples/README.md +41 -0
  17. data/examples/benchmark-rails.rb +52 -0
  18. data/examples/benchmark.rb +184 -0
  19. data/ext/mongory_ext/extconf.rb +91 -0
  20. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/array.h +122 -0
  21. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/config.h +161 -0
  22. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/error.h +79 -0
  23. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/memory_pool.h +95 -0
  24. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/table.h +127 -0
  25. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/value.h +175 -0
  26. data/ext/mongory_ext/mongory-core/include/mongory-core/matchers/matcher.h +76 -0
  27. data/ext/mongory_ext/mongory-core/include/mongory-core.h +12 -0
  28. data/ext/mongory_ext/mongory-core/src/foundations/array.c +287 -0
  29. data/ext/mongory_ext/mongory-core/src/foundations/array_private.h +19 -0
  30. data/ext/mongory_ext/mongory-core/src/foundations/config.c +270 -0
  31. data/ext/mongory_ext/mongory-core/src/foundations/config_private.h +48 -0
  32. data/ext/mongory_ext/mongory-core/src/foundations/error.c +38 -0
  33. data/ext/mongory_ext/mongory-core/src/foundations/memory_pool.c +298 -0
  34. data/ext/mongory_ext/mongory-core/src/foundations/string_buffer.c +65 -0
  35. data/ext/mongory_ext/mongory-core/src/foundations/string_buffer.h +49 -0
  36. data/ext/mongory_ext/mongory-core/src/foundations/table.c +498 -0
  37. data/ext/mongory_ext/mongory-core/src/foundations/utils.c +210 -0
  38. data/ext/mongory_ext/mongory-core/src/foundations/utils.h +70 -0
  39. data/ext/mongory_ext/mongory-core/src/foundations/value.c +500 -0
  40. data/ext/mongory_ext/mongory-core/src/matchers/array_record_matcher.c +164 -0
  41. data/ext/mongory_ext/mongory-core/src/matchers/array_record_matcher.h +47 -0
  42. data/ext/mongory_ext/mongory-core/src/matchers/base_matcher.c +122 -0
  43. data/ext/mongory_ext/mongory-core/src/matchers/base_matcher.h +100 -0
  44. data/ext/mongory_ext/mongory-core/src/matchers/compare_matcher.c +217 -0
  45. data/ext/mongory_ext/mongory-core/src/matchers/compare_matcher.h +83 -0
  46. data/ext/mongory_ext/mongory-core/src/matchers/composite_matcher.c +573 -0
  47. data/ext/mongory_ext/mongory-core/src/matchers/composite_matcher.h +125 -0
  48. data/ext/mongory_ext/mongory-core/src/matchers/existance_matcher.c +147 -0
  49. data/ext/mongory_ext/mongory-core/src/matchers/existance_matcher.h +48 -0
  50. data/ext/mongory_ext/mongory-core/src/matchers/external_matcher.c +124 -0
  51. data/ext/mongory_ext/mongory-core/src/matchers/external_matcher.h +46 -0
  52. data/ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.c +126 -0
  53. data/ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.h +46 -0
  54. data/ext/mongory_ext/mongory-core/src/matchers/literal_matcher.c +314 -0
  55. data/ext/mongory_ext/mongory-core/src/matchers/literal_matcher.h +97 -0
  56. data/ext/mongory_ext/mongory-core/src/matchers/matcher.c +252 -0
  57. data/ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.c +79 -0
  58. data/ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.h +23 -0
  59. data/ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.c +60 -0
  60. data/ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.h +23 -0
  61. data/ext/mongory_ext/mongory_ext.c +683 -0
  62. data/lib/generators/mongory/install/install_generator.rb +42 -0
  63. data/lib/generators/mongory/install/templates/initializer.rb.erb +83 -0
  64. data/lib/generators/mongory/matcher/matcher_generator.rb +56 -0
  65. data/lib/generators/mongory/matcher/templates/matcher.rb.erb +92 -0
  66. data/lib/generators/mongory/matcher/templates/matcher_spec.rb.erb +17 -0
  67. data/lib/mongory/c_query_builder.rb +44 -0
  68. data/lib/mongory/converters/abstract_converter.rb +111 -0
  69. data/lib/mongory/converters/condition_converter.rb +64 -0
  70. data/lib/mongory/converters/converted.rb +81 -0
  71. data/lib/mongory/converters/data_converter.rb +37 -0
  72. data/lib/mongory/converters/key_converter.rb +87 -0
  73. data/lib/mongory/converters/value_converter.rb +52 -0
  74. data/lib/mongory/converters.rb +8 -0
  75. data/lib/mongory/matchers/abstract_matcher.rb +219 -0
  76. data/lib/mongory/matchers/abstract_multi_matcher.rb +124 -0
  77. data/lib/mongory/matchers/and_matcher.rb +72 -0
  78. data/lib/mongory/matchers/array_record_matcher.rb +93 -0
  79. data/lib/mongory/matchers/elem_match_matcher.rb +55 -0
  80. data/lib/mongory/matchers/eq_matcher.rb +46 -0
  81. data/lib/mongory/matchers/every_matcher.rb +56 -0
  82. data/lib/mongory/matchers/exists_matcher.rb +53 -0
  83. data/lib/mongory/matchers/field_matcher.rb +147 -0
  84. data/lib/mongory/matchers/gt_matcher.rb +41 -0
  85. data/lib/mongory/matchers/gte_matcher.rb +41 -0
  86. data/lib/mongory/matchers/hash_condition_matcher.rb +62 -0
  87. data/lib/mongory/matchers/in_matcher.rb +68 -0
  88. data/lib/mongory/matchers/literal_matcher.rb +121 -0
  89. data/lib/mongory/matchers/lt_matcher.rb +41 -0
  90. data/lib/mongory/matchers/lte_matcher.rb +41 -0
  91. data/lib/mongory/matchers/ne_matcher.rb +38 -0
  92. data/lib/mongory/matchers/nin_matcher.rb +68 -0
  93. data/lib/mongory/matchers/not_matcher.rb +40 -0
  94. data/lib/mongory/matchers/or_matcher.rb +68 -0
  95. data/lib/mongory/matchers/present_matcher.rb +55 -0
  96. data/lib/mongory/matchers/regex_matcher.rb +80 -0
  97. data/lib/mongory/matchers/size_matcher.rb +54 -0
  98. data/lib/mongory/matchers.rb +176 -0
  99. data/lib/mongory/mongoid.rb +19 -0
  100. data/lib/mongory/query_builder.rb +257 -0
  101. data/lib/mongory/query_matcher.rb +93 -0
  102. data/lib/mongory/query_operator.rb +28 -0
  103. data/lib/mongory/rails.rb +15 -0
  104. data/lib/mongory/utils/context.rb +48 -0
  105. data/lib/mongory/utils/debugger.rb +125 -0
  106. data/lib/mongory/utils/rails_patch.rb +22 -0
  107. data/lib/mongory/utils/singleton_builder.rb +31 -0
  108. data/lib/mongory/utils.rb +76 -0
  109. data/lib/mongory/version.rb +5 -0
  110. data/lib/mongory.rb +123 -0
  111. data/lib/mongory_ext.so +0 -0
  112. data/mongory.gemspec +50 -0
  113. data/scripts/build_with_core.sh +292 -0
  114. data/sig/mongory.rbs +4 -0
  115. metadata +159 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8d795002721b79441196e3c7a4d46dbd93526a9c5682c7b5710f1e7b29ef60e9
4
+ data.tar.gz: c06e8b4e512211b45935f92d46e23ae265a763b523e261599b0b0a2c87fc4322
5
+ SHA512:
6
+ metadata.gz: d49b6aa46abdbaa785489a867656ae87ac4076a6656b838fade98a53270f30975885121700b9608417bea7c066dd03df9093001436894c56c7ec9ac82d110457
7
+ data.tar.gz: 0abdae2b1b8637f5256c9a8eac1f12842478a3ab35733e4d7198f49b4011bd340d6feeb68ff6faaad2a53fb742a49efe76825f965432c6d4a49d05b0fef7aca4
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --profile
data/.rubocop.yml ADDED
@@ -0,0 +1,88 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ Exclude:
4
+ - 'pre_release/**/*'
5
+ - 'vendor/**/*'
6
+ - 'node_modules/**/*'
7
+ - 'tmp/**/*'
8
+ - 'examples/**/*'
9
+ - 'ext/**/*'
10
+ - 'pkg/**/*'
11
+ - 'mongory.gemspec'
12
+ TargetRubyVersion: 2.6
13
+
14
+ Style/StringLiterals:
15
+ Enabled: true
16
+ EnforcedStyle: single_quotes
17
+
18
+ Style/StringLiteralsInInterpolation:
19
+ Enabled: true
20
+ EnforcedStyle: single_quotes
21
+
22
+ Layout/LineLength:
23
+ Max: 120
24
+
25
+ Style/PercentLiteralDelimiters:
26
+ PreferredDelimiters:
27
+ default: '()'
28
+ '%i': '()'
29
+ '%w': '()'
30
+
31
+ Metrics/ClassLength:
32
+ Enabled: false
33
+
34
+ Metrics/MethodLength:
35
+ Enabled: false
36
+
37
+ Metrics/BlockLength:
38
+ Enabled: false
39
+
40
+ Metrics/CyclomaticComplexity:
41
+ Enabled: false
42
+
43
+ Metrics/PerceivedComplexity:
44
+ Enabled: false
45
+
46
+ Style/Alias:
47
+ EnforcedStyle: prefer_alias_method
48
+
49
+ Lint/MissingSuper:
50
+ Enabled: false
51
+
52
+ Style/SelectByRegexp:
53
+ Enabled: false
54
+
55
+ Style/WordArray:
56
+ Enabled: false
57
+
58
+ Style/SymbolArray:
59
+ Enabled: false
60
+
61
+ Layout/FirstArrayElementIndentation:
62
+ Enabled: false
63
+
64
+ Lint/StructNewOverride:
65
+ Enabled: false
66
+
67
+ Style/Proc:
68
+ Enabled: false
69
+
70
+ Lint/RescueException:
71
+ Enabled: false
72
+
73
+ Naming/AccessorMethodName:
74
+ Enabled: false
75
+
76
+ Naming/PredicateName:
77
+ Enabled: false
78
+
79
+ Lint/UselessMethodDefinition:
80
+ Enabled: false
81
+
82
+ Naming/FileName:
83
+ Enabled: false
84
+
85
+ Style/Documentation:
86
+ Exclude:
87
+ - 'lib/mongory/matchers/**/*'
88
+ - 'spec/**/*'
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ --markup markdown
2
+ --markup-provider redcarpet
3
+ --output-dir doc
4
+ --readme README.md
5
+ --exclude spec/**/*
6
+
7
+ lib/**/*.rb
data/CHANGELOG.md ADDED
@@ -0,0 +1,364 @@
1
+ # Changelog
2
+ ## [0.7.1] - 2025-08-17
3
+ ### Fixes
4
+ - Linter error
5
+ - CMatcher get crash if print trace when not enable trace yet
6
+
7
+ ## [0.7.0] - 2025-08-17
8
+
9
+ ### Major Changes
10
+ - Introduced Clang bridge for the C extension, wiring Ruby DSL to `mongory-core` via `Mongory::CMatcher` and `CQueryBuilder`.
11
+
12
+ ### Features
13
+ - New `Mongory::CMatcher` with `match?`, `explain`, `trace`, `enable_trace`, `disable_trace`, and `print_trace`.
14
+ - New `QueryBuilder#c` to switch a Ruby query into the C fast path seamlessly.
15
+ - Regex bridging uses Ruby's `Regexp` under the hood for compatibility.
16
+ - Custom matcher bridge: core can delegate to Ruby matchers (build/match/lookup) when needed.
17
+ - Context bridge: shares `Utils::Context` between Ruby and C during matching.
18
+
19
+ ### Performance
20
+ - Significant speedups for large datasets when using `CMatcher`/`CQueryBuilder`.
21
+
22
+ ### Build & Tooling
23
+ - `ext/mongory_ext/extconf.rb` compiles `mongory-core` sources directly and normalizes GCC/Clang flags.
24
+ - Added explicit submodule build rules to avoid copying/linking extra artifacts.
25
+
26
+ ### Docs
27
+ - Updated README to document Clang bridge usage, availability checks, and examples.
28
+
29
+ ## [0.6.3] - 2025-05-27
30
+
31
+ ### Major Changes
32
+ - Introduced `AbstractMultiMatcher` to unify logic for compound matchers (`$and`, `$or`, `$nor`)
33
+ - Matchers are now sorted by `priority` to improve performance (early exit in `$and`, etc.)
34
+
35
+ ### Features
36
+ - Each matcher can define its own `priority` to participate in execution optimization
37
+ - `$in` and `$nin` matchers now normalize `Range` conditions into consistent matcher structures
38
+
39
+ ### Fixes
40
+ - Explicitly use `::Hash` and `::Array` in `converted.rb` to avoid namespace conflicts
41
+
42
+ ### Tests
43
+ - Added edge case specs for `$in` and `$nin` with `nil` and empty values
44
+
45
+ ### Chores
46
+ - Ignore `.vscode/` in `.gitignore`
47
+
48
+ ## [0.6.1] - 2025-04-24
49
+
50
+ ### Major Changes
51
+ - Add size matcher
52
+ - $in and $nin supports range condition
53
+ - Query matcher inherits from Hash condition matcher to accept hash condition only
54
+ - Introduced Converted to mark converted data and prevent double convert
55
+
56
+ ## [0.6.0] - 2025-04-23
57
+
58
+ ### Major Changes
59
+ - Refactored matcher system to use Proc-based implementation
60
+ - Introduced Context system for better state management
61
+ - Optimized empty condition handling with TRUE_PROC and FALSE_PROC
62
+
63
+ ### Breaking Changes
64
+ - Removed `match` method in favor of `raw_proc`
65
+ - Changed converter behavior to be executed within Proc
66
+ - Modified fallback behavior in converters
67
+
68
+ ### Features
69
+ - Added Context system for better configuration management
70
+ - Improved performance with Proc caching
71
+ - Enhanced error handling in matchers
72
+ - Better support for complex query conditions
73
+
74
+ ### Performance
75
+ - Optimized empty condition handling
76
+ - Reduced memory usage with Proc caching
77
+ - Improved execution speed with Proc-based implementation
78
+
79
+ ### Internal
80
+ - Refactored matcher system architecture
81
+ - Improved code organization and maintainability
82
+ - Enhanced test coverage
83
+
84
+ ## [0.5.0] - 2025-04-22
85
+
86
+ ### Added
87
+ - Added fast mode implementation for optimized query performance
88
+ - Added Proc-based matching for efficient record filtering
89
+ - Added error handling in fast mode execution
90
+
91
+ ### Changed
92
+ - Optimized query execution with compiled Proc objects
93
+ - Improved memory efficiency in record matching
94
+ - Enhanced error handling in query execution
95
+
96
+ ### Fixed
97
+ - Fixed potential performance bottlenecks in record matching
98
+ - Fixed error handling in query execution
99
+
100
+ ## [0.4.0] - 2025-04-20
101
+
102
+ ### ✨ Added
103
+ - Support regex matching in array fields via `ArrayRecordMatcher`.
104
+ - Example: `tags: /vip/` will now match any element inside an array.
105
+ - Publicize `MatcherGenerator#update_initializer` to allow external CLI or test usage.
106
+
107
+ ### 🧹 Changed
108
+ - Refactored `ValueConverter` to use direct method reference instead of dynamic caching logic.
109
+
110
+ ### 📝 Documentation
111
+ - Improved matcher generator template documentation.
112
+ - Added usage examples and matcher tree explanation.
113
+ - Fixed `Mongory::Debugger` references to `Mongory.debugger`.
114
+
115
+ ### 💥 Breaking
116
+ - Renamed gem from `mongory-rb` to `mongory`, affecting gemspec and file references.
117
+ - `mongory.gemspec` now used in place of `mongory-rb.gemspec`.
118
+
119
+ # Changelog
120
+
121
+ ## v0.3.0
122
+
123
+ ### New Features
124
+ - Added matcher generator (`rails g mongory:matcher`)
125
+ - Automatically generates matcher class
126
+ - Automatically generates test files
127
+ - Automatically updates initializer
128
+ - Added performance test suite
129
+ - Provides performance data for different data sizes
130
+ - Includes both simple and complex query tests
131
+
132
+ ### Improvements
133
+ - Improved code style configuration
134
+ - Updated documentation structure
135
+ - Optimized matcher-related code
136
+ - Enhanced key converter functionality
137
+ - Added support for escaped dots in string keys (e.g., `"user\\.name"` or `'user\.name'`)
138
+ - Fixed key converter registry method error
139
+ - Enhanced error handling
140
+ - Modified error class structure
141
+ - Improved documentation generation
142
+ - Fixed yardoc issues
143
+ - Expanded README content
144
+
145
+ ### Performance Data
146
+ - Simple queries:
147
+ - 1000 records: ~2.5ms
148
+ - 10000 records: ~24.5ms
149
+ - 100000 records: ~242.5ms
150
+ - Complex queries:
151
+ - 1000 records: ~3.2ms
152
+ - 10000 records: ~31.5ms
153
+ - 100000 records: ~323.0ms
154
+
155
+ ### Bug Fixes
156
+ - Fixed require insertion position in matcher generator
157
+ - Fixed key converter registry method error in Mongoid patch
158
+ - Fixed support for escaped dots in key converter
159
+
160
+ ## [0.2.0] 2025-04-17
161
+
162
+ ### ✨ Added
163
+ - `Matchers.register(method_sym, operator, klass)` API for registering custom operator matchers
164
+ - `Matchers.enable_symbol_snippets!` opt-in method to enable query snippets like `:age.gt`
165
+ - `Matchers::Validator` module for safe matcher registration validation
166
+ - `Matchers::Registry` struct to encapsulate method/operator mapping with Symbol patching
167
+ - All built-in matchers (`$regex`, `$or`, `$present`, etc.) now use declarative self-registration via `register(...)`
168
+
169
+ ### 🛠️ Changed
170
+ - Matcher lookup is now routed through `Matchers.lookup(operator)` instead of hardcoded branches
171
+ - Symbol snippet patching is now explicitly opt-in and will never override existing methods
172
+
173
+ ### 💥 Breaking (if applies)
174
+ - If any external code relies on internal matcher instantiation logic, it should switch to using `Matchers.register`
175
+
176
+ ### 🔒 Security / Safety
177
+ - All Symbol patching is guarded via `method_defined?` check to prevent conflict with Mongoid or user extensions
178
+
179
+ ## [0.1.0] 2025-04-17
180
+ - Rename Mongory to Mongory-rb and reset version to v0.1.0
181
+
182
+ ## [2.0.0-beta.2] - 2025-04-16
183
+
184
+ ### Changed
185
+ - Refactored all converter classes (`DataConverter`, `KeyConverter`, `ValueConverter`, `ConditionConverter`) into singleton classes inheriting from `AbstractConverter`
186
+ - Introduced `default_registrations` hook method to encapsulate converter setup logic internally
187
+ - Migrated fallback logic into `initialize`, removed reliance on `instance_eval`
188
+ - Renamed `converter_builder.rb` to `abstract_converter.rb`
189
+ - Refactored `Debugger` into a singleton class with `include Singleton`
190
+ - Moved `Debugger`'s setup logic into `initialize`
191
+ - All references to converters and debugger updated to use `.instance`
192
+
193
+ ### Breaking Changes
194
+ - Removed support for direct `.convert(...)` calls on converter constants (e.g., `KeyConverter.convert`); use `.instance.convert(...)` instead
195
+ - Removed `.configure` DSL on `ConditionConverter`; use `default_registrations` override instead
196
+ - Replaced `Debugger.method` access with `Debugger.instance.method`
197
+
198
+ ## [2.0.0-beta.1] - Unreleased - 2025-4-16
199
+
200
+ ### ⚠️ Breaking Changes
201
+ - Renamed `DefaultMatcher` to `LiteralMatcher`
202
+ - Renamed `ConditionMatcher` to `HashConditionMatcher`
203
+ - Renamed `CollectionMatcher` to `ArrayRecordMatcher`
204
+ - Matcher behavior now enforces diggable structure for field access
205
+ - Query no longer matches `nil` as a valid document; field conditions (like `a: nil`) require diggable structure
206
+
207
+ ### ✨ Features
208
+ - Support for `$in` and `$nin` operators in query conditions
209
+ - Delegated `nil` conditions to `OrMatcher` to improve MongoDB compatibility
210
+
211
+ ### 🧠 Debugger & Trace
212
+ - Introduced structured matcher trace logging for better debugging
213
+ - Tree-based trace visualization implemented
214
+ - Removed dependency on Ruby's PrettyPrint module
215
+
216
+ ### 🛠 Refactors
217
+ - Unified matcher dispatch logic in `dispatched_matcher`
218
+ - Simplified `render_tree` logic
219
+ - Improved fallback handling for symbol/string keys in field matchers
220
+ - Improved trace indent level calculation logic
221
+ - Removed all internal sort helpers: `#asc`, `#desc`, and `#sort_by_key`
222
+ - Sorting is no longer supported in Mongory query builder
223
+ - If needed, use `query.sort_by { |record| ... }` instead
224
+
225
+ ### ✅ Fixes
226
+ - `$every => []` now correctly returns `false` instead of `true`
227
+
228
+ ### 🧪 Test & Docs
229
+ - Refined RSpec matcher test coverage
230
+ - Updated YARD documentation across matchers
231
+ - Matcher converter display now includes full namespace
232
+
233
+ ### 📄 Planning
234
+ - Added draft design notes for the upcoming `aggregate` system
235
+
236
+ ## [1.8.0] - 2025-04-14
237
+
238
+ ### Changed
239
+
240
+ - **Refactored Matcher Architecture**
241
+ - `DigValueMatcher` has been renamed to `FieldMatcher` to better reflect its behavior.
242
+ - All matchers now use `enable_unwrap!` to explicitly control matcher flattening logic in multi-match contexts.
243
+ - `ConditionMatcher`, `CollectionMatcher`, and `DefaultMatcher` routing logic now reflects the new matcher structure.
244
+
245
+ - **Improved Matcher Trace & Tree Introspection**
246
+ - All matchers now support `.render_tree` and `.tree_title` to integrate with `QueryBuilder#explain`.
247
+ - `FieldMatcher`, `RegexMatcher`, `InMatcher`, and `NinMatcher` now display accurate introspection trees.
248
+ - Enhanced `uniq_key` implementations across matchers to prevent duplication and support correct tree merging.
249
+
250
+ - **Operator Behavior Refinement**
251
+ - `InMatcher` and `NinMatcher` now clearly distinguish between single value vs. array inputs.
252
+ - `RegexMatcher` now accepts both literal `/regex/` and `"$regex"` formats; fallback from `DefaultMatcher` is supported.
253
+
254
+ ### Documentation
255
+
256
+ - Added or improved YARD documentation across all matchers.
257
+ - All public APIs, including `render_tree`, `match`, `uniq_key`, and `tree_title` are now documented with examples and usage notes.
258
+ - `matchers/README.md` updated to reflect renames and structural clarity.
259
+
260
+ ## [1.7.0] - 2025-04-13
261
+
262
+ ### Added
263
+
264
+ - `QueryBuilder#explain` prints a tree-structured matcher breakdown using `PP`, useful for debugging.
265
+ - Matchers now support `#render_tree` and `#tree_title`, enabling structured introspection.
266
+ - `QueryBuilder#any_of` added as a semantic alias for `.and('$or' => [...])`.
267
+
268
+ ### Changed
269
+
270
+ - Filter logic restructured to use immediately-parsed matchers (`set_matcher`) instead of building on `result`.
271
+ - `.each` now directly filters via matcher tree evaluation, removing dependency on an internal condition hash.
272
+ - Removed legacy `.result` method.
273
+ - `.or(...)` now wraps existing conditions intelligently when merging mixed operator states.
274
+ - `.pluck` and `.sort_by_keys` no longer convert keys to strings, fixing inconsistency with native Mongoid behavior.
275
+
276
+ ### Deprecated
277
+
278
+ - `.asc` and `.desc` now emit deprecation warnings; they will be removed in v2.0.0.
279
+
280
+ ## [1.6.4] - 2025-04-11
281
+
282
+ ### Fixed
283
+
284
+ - `MongoidPatch` now references `Mongory::Converters::KeyConverter` directly instead of lazily accessing it through `.condition_converter`.
285
+ - Restored missing `Mongory.configure` method accidentally removed in earlier documentation refactor.
286
+ - Ensured all `.configure` entrypoints are consistently available for all converters.
287
+
288
+ ## [1.6.1] - 2025-04-11
289
+
290
+ ### Added
291
+
292
+ - **Rails Integration via Railtie**
293
+ Mongory now auto-integrates with Rails if present, using a new `Mongory::Railtie` and `RailsPatch` module.
294
+
295
+ - **Mongoid Integration Module**
296
+ Added `mongory/mongoid` which registers `Mongoid::Criteria::Queryable::Key` for symbolic query operators (e.g. `:age.gt`).
297
+
298
+ - **Conditional Auto-Require**
299
+ `mongory.rb` now conditionally requires `rails` and `mongoid` integration modules when Rails or Mongoid is detected.
300
+
301
+ - **YARD Documentation**
302
+ Improved YARD docstrings for all public APIs, including `QueryOperator`, `InstallGenerator`, and matchers.
303
+
304
+ ### Changed
305
+
306
+ - **Generator Initializer Cleanup**
307
+ Removed direct Mongoid-specific converter registration from generator output. This logic is now encapsulated in `mongory/mongoid.rb`.
308
+
309
+ - **Improved Symbol DSL Activation**
310
+ Symbol snippets (`:age.gt => 30`) are now opt-in, via `Mongory.enable_symbol_snippets!`, and properly isolated from default runtime.
311
+
312
+ - **Safer Core Patch for present?/blank?**
313
+ When in Rails, Mongory will use `Object#present?` and `Object#blank?` instead of internal implementations, for better semantic consistency.
314
+
315
+ ## [1.6.0] - 2025-04-11
316
+
317
+ ### Added
318
+ - **Custom Operator: `$every`**
319
+ Added support for `$every`, a new matcher that succeeds only if *all* elements in an array satisfy the condition.
320
+ - **Custom Error Class: `Mongory::TypeError`**
321
+ Replaces Ruby's `TypeError` for internal validation, enabling cleaner and safer error handling.
322
+ - **Internal API: `SingletonBuilder`**
323
+ Introduced a unified abstraction for building singleton converters and utilities (used by `Debugger`, all Converters, etc.).
324
+
325
+ ### Changed
326
+ - **Unified Matcher Construction**
327
+ All matchers now use `.build(...)` instead of `.new(...)` for consistent instantiation.
328
+ - **Simplified Matcher Dispatch**
329
+ Multi-matchers (`$and`, `$or`, etc.) now unwrap themselves when only one submatcher is present.
330
+ - **Centralized Matcher Responsibility**
331
+ `ConditionMatcher` replaces `DefaultMatcher` as the default dispatcher for query conditions.
332
+ - **Consistent Data Conversion**
333
+ All nested matchers (e.g. `FieldMatcher`, `ElemMatchMatcher`) now apply `data_converter` at match-time.
334
+
335
+ ### Fixed
336
+ - **Validation Improvements**
337
+ Introduced `deep_check_validity!` to ensure all nested matchers are properly verified.
338
+ - **Edge Case Consistency**
339
+ Cleaner fallback handling and key traversal behavior under complex or mixed-type query structures.
340
+
341
+ ---
342
+
343
+ ## [1.5.0] - 2025-04-09
344
+
345
+ ### Added
346
+ - **YARD Documentation**: Added `.yardopts` configuration file for generating documentation.
347
+ - **Converters Module**: Introduced `Mongory::Converters` module with `DataConverter` and `ConditionConverter` classes for better data and condition normalization.
348
+ - **Debugger**: Exposed `Utils::Debugger` for better debug control and query tracing.
349
+
350
+ ### Changed
351
+ - **QueryBuilder Refactor**: Simplified `build_query` method to use `QueryBuilder` directly without namespace.
352
+ - **Data and Condition Converters**: Directly exposed `data_converter` and `condition_converter` via `Mongory` module for easier access and configuration.
353
+ - **Removed Config Class**: Removed `Config` class and replaced with direct configuration in `Mongory`.
354
+
355
+ ### Fixed
356
+ - **Bug Fixes**: Corrected issues with array comparisons and query operator behaviors.
357
+
358
+ ---
359
+
360
+ ## [Prior Versions Summary]
361
+
362
+ - `1.0.1`: Initial release
363
+ - `1.1.0 ~ 1.3.3`: Refactored matcher architecture, added class inheritance structure, separated key/value matcher logic.
364
+ - `1.4.x`: Skipped
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at koten0224@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 frank0224
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
13
+ all 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 NONINFRINGEMENT. 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
21
+ THE SOFTWARE.