mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 17:30:43 -07:00
Fix broken map test and add sort test
This commit is contained in:
@@ -101,7 +101,6 @@ module Liquid
|
||||
def map(input, property)
|
||||
flatten_if_necessary(input).map do |e|
|
||||
e = e.call if e.is_a?(Proc)
|
||||
e = e.to_liquid if e.respond_to?(:to_liquid)
|
||||
|
||||
if property == "to_liquid"
|
||||
e
|
||||
@@ -249,13 +248,14 @@ module Liquid
|
||||
private
|
||||
|
||||
def flatten_if_necessary(input)
|
||||
if input.is_a?(Array)
|
||||
ary = if input.is_a?(Array)
|
||||
input.flatten
|
||||
elsif input.kind_of?(Enumerable)
|
||||
input
|
||||
else
|
||||
[input].flatten
|
||||
end
|
||||
ary.map{ |e| e.respond_to?(:to_liquid) ? e.to_liquid : e }
|
||||
end
|
||||
|
||||
def to_number(obj)
|
||||
|
||||
Reference in New Issue
Block a user