mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-17 01:40:42 -07:00
Add round_to_s filter with tests
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user