fix number display
This commit is contained in:
parent
873e8d44a2
commit
ae392ad861
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue