Add round_to_s filter with tests

This commit is contained in:
Bimal Bhagrath
2019-05-16 14:10:09 -04:00
parent b3b63a683f
commit bfc6f61563
2 changed files with 12 additions and 0 deletions
+5
View File
@@ -391,6 +391,11 @@ module Liquid
raise Liquid::FloatDomainError, e.message
end
def round_to_s(input, n = 0)
result = Utils.to_number(input)
sprintf("%.#{n}f", result)
end
def ceil(input)
Utils.to_number(input).ceil.to_i
rescue ::FloatDomainError => e