liquid-nested-sort 0.1.4 → 0.1.5
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/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/liquid_nested_sort/nested_filters.rb +4 -0
- data/liquid-nested-sort.gemspec +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: f960256f408a36cc9c3f5f0f1be3296aa3a919734716a3d1f25bb043e6a5c443
|
4
|
+
data.tar.gz: a1a35ae637123dd1925a5407d02f151054cdb672d42dae2fa5b1749b9579ae6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a951ded949279e72f38cb86b07594cd7c50a09455e2994a1b688a0e3f720f06c45d3c23bad2767d30b03dfc6e93e96a160fc161770434ffdc683c9f613232ee4
|
7
|
+
data.tar.gz: e57d65ed6c30ebb6103da33d93450a6d5014102849b852fb837e15b862453d946e3c328039e61efba75a5a66e4669d885c9f022a40d970dc3ba6ffecd0c4c232
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[](https://rubygems.org/gems/liquid-nested-sort)
|
4
4
|
|
5
5
|
`nested_sort` and `nested_sort_natural`, sort and sort_natural-like filters
|
6
|
-
with nested fields support for Liquid.
|
6
|
+
with nested fields support for [Liquid](https://shopify.github.io/liquid/).
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -76,6 +76,10 @@ module NestedFilters
|
|
76
76
|
ary.sort do |a, b|
|
77
77
|
LiquidUtils.nil_safe_compare(a, b)
|
78
78
|
end
|
79
|
+
elsif property.include?('.') && LiquidUtils.nested_respond_to?(ary.first, property)
|
80
|
+
ary.sort do |a, b|
|
81
|
+
LiquidUtils.nil_safe_compare(LiquidUtils.nested_send(a, property), LiquidUtils.nested_send(b, property))
|
82
|
+
end
|
79
83
|
elsif ary.all? { |el| el.respond_to?(:[]) }
|
80
84
|
begin
|
81
85
|
ary.sort { |a, b| LiquidUtils.nil_safe_compare(a[property], b[property]) }
|
data/liquid-nested-sort.gemspec
CHANGED