number_to_human_size (ActionView::Helpers::NumberHelper)

    # File lib/action_view/helpers/number_helper.rb, line 251
          def number_to_human_size(number, *args)
            return number.nil? ? nil : pluralize(number.to_i, "Byte") if number.to_i < 1024

            options = args.extract_options!
            options.symbolize_keys!

            defaults = I18n.translate('number.format''number.format', :locale => options[:locale], :raise => true) rescue {}
            human    = I18n.translate('number.human.format''number.human.format', :locale => options[:locale], :raise => true) rescue {}
            defaults = defaults.merge(human)

            unless args.empty?
              ActiveSupport::Deprecation.warn('number_to_human_size takes an option hash ' +
                'instead of a separate precision argument.', caller)
              precision = args[0] || defaults[:precision]
            end

            precision ||= (options[:precision] || defaults[:precision])
            separator ||= (options[:separator] || defaults[:separator])
            delimiter ||= (options[:delimiter] || defaults[:delimiter])

            max_exp  = STORAGE_UNITS.size - 1
            number   = Float(number)
            exponent = (Math.log(number) / Math.log(1024)).to_i # Convert to base 1024
            exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit
            number  /= 1024 ** exponent
            unit     = STORAGE_UNITS[exponent]

            begin
              escaped_separator = Regexp.escape(separator)
              number_with_precision(number,
                :precision => precision,
                :separator => separator,
                :delimiter => delimiter
              ).sub(/(\d)(#{escaped_separator}[1-9]*)?0+\z/, '\1\2').sub(/#{escaped_separator}\z/, '') + " #{unit}"
            rescue
              number
            end
          end