Flowdock
method

convert

Importance_0
v4.2.7 - Show latest stable - 0 notes - Class: NumberToHumanConverter
convert() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/number_helper/number_to_human_converter.rb, line 11
      def convert # :nodoc:
        @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)

        unit = determine_unit(units, exponent)

        rounded_number = NumberToRoundedConverter.convert(number, options)
        format.gsub(/%n/, rounded_number).gsub(/%u/, unit).strip
      end
Register or log in to add new notes.