chewy 8.4.0 → 8.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/chewy/index/compiled.rb +17 -11
- data/lib/chewy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7ffb0b83cbd361f40168edad592083762af5035dc02ca60f205f16c6224a9a6
|
|
4
|
+
data.tar.gz: ca56cddc2b59646fbaa9188c707c1d9f23d9dabf2166e1a1ff168d83adf6e6ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91751c0575275edd79e08a945fed07b775a6cd0cd216c3fcba95fbab4085b22dd476d23485c63ee93d740b3f2b8e08bc742789e6f60313fcc49d43013bd48ebe
|
|
7
|
+
data.tar.gz: 4de8630df6346a7eccbbd14ca0cc2b5d84d636e314c58840cae605433a570e6a9b6c07bf8d2f27b695808efcdc491b41006fd4a18038412ee485fe36669711bb
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
|
|
9
9
|
### Changes
|
|
10
10
|
|
|
11
|
+
## 8.4.1 (2026-06-19)
|
|
12
|
+
|
|
13
|
+
### New Features
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* [#1043](https://github.com/toptal/chewy/pull/1043)Fixed `field ..., value: proc(&:method)` (and other splat-declaring procs) raising `ArgumentError: wrong number of arguments` during import. The compiled compose path introduced in 8.4.0 forwarded `crutches`/`context` as extra positional arguments to splat procs; `Symbol#to_proc` then passed them on to the method. Splat procs are now called with the object alone, matching the plain compose path. ([@AlfonsoUceda][])
|
|
18
|
+
|
|
19
|
+
### Changes
|
|
20
|
+
|
|
11
21
|
## 8.4.0 (2026-06-17)
|
|
12
22
|
|
|
13
23
|
### New Features
|
data/lib/chewy/index/compiled.rb
CHANGED
|
@@ -187,17 +187,24 @@ module Chewy
|
|
|
187
187
|
idx = @procs.size
|
|
188
188
|
@procs << v
|
|
189
189
|
procs_ref = "compiled_procs[#{idx}]"
|
|
190
|
-
|
|
191
|
-
case v.arity
|
|
192
|
-
when 0
|
|
190
|
+
if v.arity.zero?
|
|
193
191
|
"#{obj_var}.instance_exec(&#{procs_ref})"
|
|
192
|
+
elsif v.parameters.any? { |type, _| type == :rest }
|
|
193
|
+
# Procs that declare a splat — Symbol#to_proc (`proc(&:method)`,
|
|
194
|
+
# parameters `[[:req], [:rest]]`) and `->(*args)` — must NOT
|
|
195
|
+
# receive crutches/context as extra positional args: a symbol
|
|
196
|
+
# proc would forward them to the method (`obj.method(crutches,
|
|
197
|
+
# context)` => "wrong number of arguments"). Mirror the plain
|
|
198
|
+
# Base#value_by_proc negative-arity branch (`value.call(*object)`)
|
|
199
|
+
# so the compiled and fallback paths behave identically.
|
|
200
|
+
"#{procs_ref}.call(*#{obj_var})"
|
|
194
201
|
else
|
|
195
202
|
# Pass only as many of (object, crutches, context) as the
|
|
196
203
|
# proc actually declares. This keeps lambdas with optional
|
|
197
204
|
# args (negative arity like `->(o, c=nil)`) from being
|
|
198
205
|
# called with too many arguments. Anything beyond context
|
|
199
206
|
# truncates to all three.
|
|
200
|
-
args = [obj_var, 'crutches', 'context'].first(
|
|
207
|
+
args = [obj_var, 'crutches', 'context'].first(positional_param_count(v))
|
|
201
208
|
"#{procs_ref}.call(#{args.join(', ')})"
|
|
202
209
|
end
|
|
203
210
|
else
|
|
@@ -212,14 +219,13 @@ module Chewy
|
|
|
212
219
|
end
|
|
213
220
|
end
|
|
214
221
|
|
|
215
|
-
# Number of
|
|
216
|
-
# required + optional
|
|
217
|
-
#
|
|
222
|
+
# Number of (object, crutches, context) args to pass to a splat-free
|
|
223
|
+
# proc: its required + optional positional parameters, capped at the
|
|
224
|
+
# three available. Splat procs are handled by the caller and never
|
|
225
|
+
# reach here.
|
|
218
226
|
def positional_param_count(proc)
|
|
219
|
-
|
|
220
|
-
required
|
|
221
|
-
has_splat = params.any? { |type, _| type == :rest }
|
|
222
|
-
has_splat ? 3 : [required, 3].min
|
|
227
|
+
required = proc.parameters.count { |type, _| %i[req opt].include?(type) }
|
|
228
|
+
[required, 3].min
|
|
223
229
|
end
|
|
224
230
|
|
|
225
231
|
def safe_identifier?(name)
|
data/lib/chewy/version.rb
CHANGED