Flowdock
method

convert

Importance_0
v6.1.3.1 - Show latest stable - 0 notes - Class: NumberToHumanSizeConverter
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_size_converter.rb, line 13
      def convert
        @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", number_to_format).gsub("%u", unit)
      end
Register or log in to add new notes.