class ActiveSupport::NumberHelper::NumberToHumanSizeConverter
def convert
def convert if opts.key?(:prefix) ActiveSupport::Deprecation.warn('The :prefix option of `number_to_human_size` is deprecated and will be removed in Rails 5.1 with no replacement.') end @number = Float(number) # for backwards compatibility with those that didn't add strip_insignificant_zeros to their locale files unless options.key?(:strip_insignificant_zeros) options[:strip_insignificant_zeros] = true end if smaller_than_base? number_to_format = number.to_i.to_s else human_size = number / (base ** exponent) number_to_format = NumberToRoundedConverter.convert(human_size, options) end conversion_format.gsub('%n'.freeze, number_to_format).gsub('%u'.freeze, unit) end