Merge pull request #234 from Shopify/fix_mapping_procs

Fix mapping over procs
This commit is contained in:
Florian Weingarten
2013-10-09 16:32:53 -04:00
committed by Arthur Neves
parent 4207d1f086
commit 6cb5a9b7cc
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