1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Review changes

This commit is contained in:
Hector Bustillos 2019-12-13 13:51:45 -07:00
parent 92fea7a574
commit f8cf66caf4

View file

@ -9,12 +9,13 @@ module ActiveSupport
def convert
number = self.number.to_s.strip
number_f = number.to_f
format = options[:format]
if number.to_f.negative?
number = absolute_value(number)
if number_f.negative?
number = number_f.abs
unless options[:precision] == 0 && number.to_f < 0.5
unless options[:precision] == 0 && number < 0.5
format = options[:negative_format]
end
end
@ -24,10 +25,6 @@ module ActiveSupport
end
private
def absolute_value(number)
number.respond_to?(:abs) ? number.abs : number.sub(/\A-/, "")
end
def options
@options ||= begin
defaults = default_format_options.merge(i18n_opts)