Rename min/max filters for clarity

This commit is contained in:
Thibaut Courouble
2017-12-06 09:48:30 -05:00
parent 282d42f98d
commit 147d7ae24d
2 changed files with 26 additions and 26 deletions
+10 -10
View File
@@ -353,19 +353,19 @@ module Liquid
raise Liquid::FloatDomainError, e.message
end
def max(input, n)
max_value = Utils.to_number(n)
result = Utils.to_number(input)
result = max_value if max_value > result
result.is_a?(BigDecimal) ? result.to_f : result
end
def min(input, n)
def at_least(input, n)
min_value = Utils.to_number(n)
result = Utils.to_number(input)
result = min_value if min_value < result
result = min_value if min_value > result
result.is_a?(BigDecimal) ? result.to_f : result
end
def at_most(input, n)
max_value = Utils.to_number(n)
result = Utils.to_number(input)
result = max_value if max_value < result
result.is_a?(BigDecimal) ? result.to_f : result
end