Fix mapping over procs

This commit is contained in:
Florian Weingarten
2013-07-25 22:11:44 -04:00
parent b004acf856
commit 3e13ed4ba1
2 changed files with 38 additions and 4 deletions
+5 -4
View File
@@ -101,11 +101,12 @@ module Liquid
def map(input, property)
ary = [input].flatten
ary.map do |e|
if e.respond_to?(:to_liquid)
e = e.to_liquid
end
e = e.call if e.is_a?(Proc)
e = e.to_liquid if e.respond_to?(:to_liquid)
if e.respond_to?('[]')
if property == "to_liquid"
e
elsif e.respond_to?(:[])
e[property]
end
end