Method: Liquid::StandardFilters#round
- Defined in:
- lib/liquid/standardfilters.rb
#round(input, n = 0) ⇒ Object
863 864 865 866 867 868 869 870 |
# File 'lib/liquid/standardfilters.rb', line 863 def round(input, n = 0) result = Utils.to_number(input).round(Utils.to_number(n)) result = result.to_f if result.is_a?(BigDecimal) result = result.to_i if n == 0 result rescue ::FloatDomainError => e raise Liquid::FloatDomainError, e. end |