mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Fix mapping over procs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user