Skip to content

Commit d5df53d

Browse files
committed
Always stringify sum property.
1 parent f5d6a36 commit d5df53d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/liquid/standardfilters.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -952,11 +952,13 @@ def default(input, default_value = '', options = {})
952952
# @liquid_syntax array | sum
953953
# @liquid_return [number]
954954
def sum(input, property = nil)
955+
property = Liquid::Utils.to_s(property)
956+
955957
ary = InputIterator.new(input, context)
956958
return 0 if ary.empty?
957959

958960
values_for_sum = ary.map do |item|
959-
if property.nil?
961+
if property.empty?
960962
item
961963
elsif item.respond_to?(:[])
962964
item[property]

0 commit comments

Comments
 (0)