fix number display

This commit is contained in:
wvengen 2014-06-21 11:25:58 +02:00
parent 873e8d44a2
commit ae392ad861
1 changed files with 2 additions and 2 deletions

View File

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