Module: SumFilter

Defined in:
lib/liquidum/liquid/filters/sum_filter.rb

Instance Method Summary collapse

Instance Method Details

#sum(input) ⇒ Object

Sums the items in the array

input - the object array

Returns the sum



9
10
11
12
13
14
# File 'lib/liquidum/liquid/filters/sum_filter.rb', line 9

def sum(input)
  return input unless input.respond_to?(:sum)

  input = input.values if input.is_a?(Hash) # FIXME
  input.sum
end