Remove number_display.rb

This commit is contained in:
Patrick Gansterer 2020-03-23 12:53:21 +01:00
parent 5f2e319469
commit 67ab647eb0
9 changed files with 18 additions and 35 deletions

View file

@ -1,22 +0,0 @@
# we'd like to show "0.0" as "0"
class Float
alias :foodsoft_to_s :to_s
def to_s
foodsoft_to_s.gsub /(\.0*|(\.[0-9]+?)0+)$/, '\2'
end
end
# allow +to_s+ on bigdecimal without argument too
if defined? BigDecimal
class BigDecimal
alias :foodsoft_to_s :to_s
def to_s(*args)
if args.present?
foodsoft_to_s(*args)
else
foodsoft_to_s(*args).gsub /(\.0*|(\.[0-9]+?)0+)$/, '\2'
end
end
end
end