mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
abs filter
This commit is contained in:
@@ -289,6 +289,12 @@ module Liquid
|
||||
array.last if array.respond_to?(:last)
|
||||
end
|
||||
|
||||
# absolute value
|
||||
def abs(input)
|
||||
result = Utils.to_number(input).abs
|
||||
result.is_a?(BigDecimal) ? result.to_f : result
|
||||
end
|
||||
|
||||
# addition
|
||||
def plus(input, operand)
|
||||
apply_operation(input, operand, :+)
|
||||
|
||||
Reference in New Issue
Block a user