mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Make 'map' filter work on Enumerable drops
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user