mongory 2.0.1-x86_64-linux → 2.1.0-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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +5 -0
- data/lib/mongory/version.rb +1 -1
- data/lib/mongory.rb +28 -6
- data/renovate.json +6 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b2f42ef3e29de6eddae44a1f6a89f4131080d6caaabe91feac496c66b65793f4
|
|
4
|
+
data.tar.gz: 635eb9ae306c9ed61ec67afc12d7ecdb123d5ed621ba8ff61435fc05388b156f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97e169a3eefa07d0910458382dd3c41711e33a77a4b28e5285b0cb65c676b0d971fa3b3bfbe5aeab568942ee247747ed081c6e506f4c1ed7a1c82359a61dcecb
|
|
7
|
+
data.tar.gz: 6691a6abad840bd78933d985d9e4d317626ec205e0ea2b35a49146ae133044750963f460b600acb3db698cb450a0fad2b5a5ea61b968012603ba7a42e8fa937a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.1.0] - 2026-11-23
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **`Mongory.compile` & `Mongory.query`**: Added `Mongory.compile(condition)` (alias `build_matcher`) and `Mongory.query(records)` (alias `build_query`) as primary entry points aligned across the Mongory ecosystem.
|
|
7
|
+
|
|
8
|
+
### Fixes
|
|
9
|
+
- **C Extension Load Verification & Source-Gem Fallback (`lib/mongory.rb`)**: Fall back to `require 'mongory_ext'` when precompiled `core/<abi>/mongory_ext` is absent (supporting source-gem installs), and verify that `Mongory::Matcher#match?` is defined before reopening `Mongory::Matcher` so stale or incompatible C extensions fail fast with a clear `LoadError`.
|
|
10
|
+
|
|
3
11
|
## [2.0.1] - 2026-11-22
|
|
4
12
|
|
|
5
13
|
Aligns with `mongory-core` `v0.3.0` and finishes v2.0.0 cleanup.
|
data/README.md
CHANGED
|
@@ -59,6 +59,11 @@ matched = records.mongory
|
|
|
59
59
|
rule = JSON.parse('{"age": {"$gte": 18}, "$or": [{"name": {"$regex": "^J"}}, {"name": "Bob"}]}')
|
|
60
60
|
records.mongory.where(rule).pluck('name')
|
|
61
61
|
# => ["Jack", "Bob"]
|
|
62
|
+
|
|
63
|
+
# 3. Compile once as a reusable, thread-safe Matcher (ideal for constants)
|
|
64
|
+
ADULT_RULE = Mongory.compile(:age.gte => 18, :active => true)
|
|
65
|
+
ADULT_RULE.match?(records.first)
|
|
66
|
+
# => true
|
|
62
67
|
```
|
|
63
68
|
|
|
64
69
|
### Query Builder Methods
|
data/lib/mongory/version.rb
CHANGED
data/lib/mongory.rb
CHANGED
|
@@ -74,22 +74,33 @@ module Mongory
|
|
|
74
74
|
@condition_converter ||= Converters::ConditionConverter.instance
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
# Builds a new query over the given record set.
|
|
77
|
+
# Builds a new query builder over the given record set.
|
|
78
|
+
#
|
|
79
|
+
# @example
|
|
80
|
+
# Mongory.query(records).where(:age.gte => 18).pluck(:name)
|
|
78
81
|
#
|
|
79
82
|
# @param records [Enumerable] any enumerable object (Array, AR::Relation, etc.)
|
|
80
83
|
# @return [QueryBuilder] a new query builder
|
|
81
|
-
def self.
|
|
84
|
+
def self.query(records)
|
|
82
85
|
QueryBuilder.new(records)
|
|
83
86
|
end
|
|
84
87
|
|
|
85
|
-
|
|
88
|
+
singleton_class.alias_method :build_query, :query
|
|
89
|
+
|
|
90
|
+
# Compiles a reusable matcher for the given condition.
|
|
91
|
+
#
|
|
92
|
+
# @example
|
|
93
|
+
# ADULT = Mongory.compile(:age.gte => 18)
|
|
94
|
+
# ADULT.match?(age: 20) #=> true
|
|
86
95
|
#
|
|
87
96
|
# @param condition [Hash] the query condition
|
|
88
|
-
# @return [Matcher] a new matcher
|
|
89
|
-
def self.
|
|
97
|
+
# @return [Matcher] a new compiled matcher
|
|
98
|
+
def self.compile(condition)
|
|
90
99
|
Matcher.new(condition)
|
|
91
100
|
end
|
|
92
101
|
|
|
102
|
+
singleton_class.alias_method :build_matcher, :compile
|
|
103
|
+
|
|
93
104
|
# Registers a class to support `.mongory` query DSL.
|
|
94
105
|
# This injects a `#mongory` method into the given class.
|
|
95
106
|
#
|
|
@@ -123,6 +134,17 @@ module Mongory
|
|
|
123
134
|
end
|
|
124
135
|
|
|
125
136
|
abi = RUBY_VERSION.split('.').first(2).join('.')
|
|
126
|
-
|
|
137
|
+
begin
|
|
138
|
+
require_relative "core/#{abi}/mongory_ext"
|
|
139
|
+
rescue LoadError
|
|
140
|
+
require 'mongory_ext'
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
unless defined?(Mongory::Matcher) && Mongory::Matcher.method_defined?(:match?)
|
|
144
|
+
raise LoadError,
|
|
145
|
+
"Incompatible or outdated mongory_ext loaded for Ruby #{abi} (Mongory::Matcher not defined). " \
|
|
146
|
+
'Please recompile the C extension (e.g. `bundle exec rake compile`).'
|
|
147
|
+
end
|
|
148
|
+
|
|
127
149
|
require_relative 'mongory/matcher'
|
|
128
150
|
require_relative 'mongory/query_builder'
|
data/renovate.json
ADDED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongory
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: x86_64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- koten0224
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A Mongo-like in-memory query DSL for Ruby
|
|
14
14
|
email:
|
|
@@ -116,6 +116,7 @@ files:
|
|
|
116
116
|
- lib/mongory/utils/tree_renderer.rb
|
|
117
117
|
- lib/mongory/version.rb
|
|
118
118
|
- mongory.gemspec
|
|
119
|
+
- renovate.json
|
|
119
120
|
- script/bench.rb
|
|
120
121
|
- scripts/build_with_core.sh
|
|
121
122
|
- sig/mongory.rbs
|