Merge pull request #234 from Shopify/fix_mapping_procs

Fix mapping over procs
This commit is contained in:
Florian Weingarten
2013-10-09 15:24:45 -04:00
committed by Arthur Neves
parent 6eb1f174de
commit 145920738b
2 changed files with 38 additions and 4 deletions
+5 -4
View File
@@ -94,11 +94,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