def percentage(number, precision = 2)
      return if number.to_s.empty?

      ret = "%02.#{ precision }f%" % number
      ret.gsub(/\.0*%$/, '%')
    end
def percentage(number, precision = 2)
      return if number.to_s.empty?

      ret = "%02.#{ precision }f%" % number
      ret.gsub(/\.0*%$/, '%')
    end
Show the percentage representation of a numeric value.

 @example
   percentage(100) == "100.00%"
   percentage(100, 0) == "100%"

 @param [Numeric] number A numeric value
 @param [Fixnum]  precision (defaults to 2) Number of decimals to show.
 @return [String] the number displayed as a percentage
 @return [nil]    given a nil value or an empty string.