fix number display

This commit is contained in:
wvengen 2014-06-21 11:25:58 +02:00
parent 873e8d44a2
commit ae392ad861

View file

@ -3,7 +3,7 @@
class Float class Float
alias :foodsoft_to_s :to_s alias :foodsoft_to_s :to_s
def to_s def to_s
foodsoft_to_s.chomp(".0") foodsoft_to_s.gsub /(\.0*|(\.[0-9]+?)0+)$/, '\2'
end end
end end
@ -11,7 +11,7 @@ if defined? BigDecimal
class BigDecimal class BigDecimal
alias :foodsoft_to_s :to_s alias :foodsoft_to_s :to_s
def to_s(format = DEFAULT_STRING_FORMAT) def to_s(format = DEFAULT_STRING_FORMAT)
foodsoft_to_s(format).chomp(".0") foodsoft_to_s(format).gsub /(\.0*|(\.[0-9]+?)0+)$/, '\2'
end end
end end
end end