method

convert

rails latest stable - Class: ActiveSupport::NumberHelper::NumberToHumanConverter
convert()
public

No documentation available.

# File activesupport/lib/active_support/number_helper/number_to_human_converter.rb, line 15
      def convert # :nodoc:
        @number = RoundingHelper.new(options).round(number)
        @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

        units = opts[:units]
        exponent = calculate_exponent(units)
        @number = number / (10**exponent)

        rounded_number = NumberToRoundedConverter.convert(number, options)
        unit = determine_unit(units, exponent)
        format.gsub("%n", rounded_number).gsub("%u", unit).strip
      end