active_object 5.14.0 → 5.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_object/enumerable.rb +11 -7
- data/lib/active_object/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: cb19625019f41c64b80e88adeaff3bb7871e43a21d6886ffa74fa04e9a28b9f4
|
4
|
+
data.tar.gz: a12e3daa0636b987824b717ab5572ed85cba1df7e2f65ba16f744bd7136c9238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a8f4e1f9915e0e4d692e2d2efa7683d2ecaf9d3c2894dc5d3080537f6672eb54348e40150d2a6acbcf747fb3f40b4306adf419d84b561a44b8103d2a8bdb3f3
|
7
|
+
data.tar.gz: f8363de0e1e69f15809ecaffa530ceca2b4407e96e92196d63ec6cb62dc4be1bd4dc932fc2c1f1290f4626f386718f19cd6a1eb854c8e450f78e7816c44042be
|
@@ -231,13 +231,17 @@ if ActiveObject.configuration.autoload_enumerable
|
|
231
231
|
return identity unless length.positive?
|
232
232
|
|
233
233
|
collection_sorted = sort
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
234
|
+
index = (num.to_f / 100) * collection_sorted.length - 1
|
235
|
+
|
236
|
+
if index != index.to_i
|
237
|
+
collection_sorted[index.ceil] || identity
|
238
|
+
elsif collection_sorted.length.even?
|
239
|
+
sample_one = collection_sorted.at(index)
|
240
|
+
sample_two = collection_sorted.at(index + 1)
|
241
|
+
(sample_one + sample_two) / 2
|
242
|
+
else
|
243
|
+
collection_sorted[index] || identity
|
244
|
+
end
|
241
245
|
end
|
242
246
|
# rubocop:enable Metrics/AbcSize
|
243
247
|
|