mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Review changes
This commit is contained in:
parent
92fea7a574
commit
f8cf66caf4
1 changed files with 4 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue