liquid 5.7.0 → 5.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +6 -0
- data/lib/liquid/standardfilters.rb +5 -5
- data/lib/liquid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 771dc6f35b1b6c881e98289584bbcf8f0b0a2c494ddf1b6bf14bda94aa6ef991
|
4
|
+
data.tar.gz: 5de0ba09a9e281fd713480edafb79dc5580f3ef1233a6f7c27d45897649a2fa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09c9b6247637be3d1a7f9b9bdaff3351d72d3215d2cd7eaaf213d97eaca99ba5faef92bc89165c13f1b34fa3742a3de4e26fddba0d6390587e7a640d3af54ae3'
|
7
|
+
data.tar.gz: 1afb6aca240c13c8ca09bb5079094a69e98bf48d83a1016ee261c34862dadd35e1bf8d64c906f12ecba3c616656f33f3576a3237eddc0d2ec4e97fd0e10bd43f
|
data/History.md
CHANGED
@@ -2,9 +2,15 @@
|
|
2
2
|
|
3
3
|
## 5.8.0 (unreleased)
|
4
4
|
|
5
|
+
## 5.7.1 2025-01-23
|
6
|
+
|
7
|
+
* Fix the `find` and `find_index`filters to return `nil` when filtering empty arrays
|
8
|
+
* Fix the `has` filter to return `false` when filtering empty arrays
|
9
|
+
|
5
10
|
## 5.7.0 2025-01-16
|
6
11
|
|
7
12
|
### Features
|
13
|
+
|
8
14
|
* Add `find`, `find_index`, `has`, and `reject` filters to arrays
|
9
15
|
* Compatibility with Ruby 3.4
|
10
16
|
|
@@ -459,7 +459,7 @@ module Liquid
|
|
459
459
|
# @liquid_syntax array | some: string, string
|
460
460
|
# @liquid_return [boolean]
|
461
461
|
def has(input, property, target_value = nil)
|
462
|
-
filter_array(input, property, target_value) { |ary, &block| ary.any?(&block) }
|
462
|
+
filter_array(input, property, target_value, false) { |ary, &block| ary.any?(&block) }
|
463
463
|
end
|
464
464
|
|
465
465
|
# @liquid_public_docs
|
@@ -472,7 +472,7 @@ module Liquid
|
|
472
472
|
# @liquid_syntax array | find: string, string
|
473
473
|
# @liquid_return [untyped]
|
474
474
|
def find(input, property, target_value = nil)
|
475
|
-
filter_array(input, property, target_value) { |ary, &block| ary.find(&block) }
|
475
|
+
filter_array(input, property, target_value, nil) { |ary, &block| ary.find(&block) }
|
476
476
|
end
|
477
477
|
|
478
478
|
# @liquid_public_docs
|
@@ -485,7 +485,7 @@ module Liquid
|
|
485
485
|
# @liquid_syntax array | find_index: string, string
|
486
486
|
# @liquid_return [number]
|
487
487
|
def find_index(input, property, target_value = nil)
|
488
|
-
filter_array(input, property, target_value) { |ary, &block| ary.find_index(&block) }
|
488
|
+
filter_array(input, property, target_value, nil) { |ary, &block| ary.find_index(&block) }
|
489
489
|
end
|
490
490
|
|
491
491
|
# @liquid_public_docs
|
@@ -969,10 +969,10 @@ module Liquid
|
|
969
969
|
|
970
970
|
attr_reader :context
|
971
971
|
|
972
|
-
def filter_array(input, property, target_value, &block)
|
972
|
+
def filter_array(input, property, target_value, default_value = [], &block)
|
973
973
|
ary = InputIterator.new(input, context)
|
974
974
|
|
975
|
-
return
|
975
|
+
return default_value if ary.empty?
|
976
976
|
|
977
977
|
block.call(ary) do |item|
|
978
978
|
if target_value.nil?
|
data/lib/liquid/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liquid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.7.
|
4
|
+
version: 5.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Lütke
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-24 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: strscan
|