Make 'map' filter work on Enumerable drops

This commit is contained in:
Florian Weingarten
2013-07-26 10:35:28 -04:00
parent 554675d1f8
commit 65dfd57bb5
2 changed files with 20 additions and 1 deletions
+8 -1
View File
@@ -99,7 +99,14 @@ module Liquid
# map/collect on a given property
def map(input, property)
ary = [input].flatten
ary = if input.is_a?(Array)
input.flatten
elsif !input.class.include?(Enumerable)
[input].flatten
else
input
end
ary.map do |e|
e = e.call if e.is_a?(Proc)
e = e.to_liquid if e.respond_to?(:to_liquid)