aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb
blob: 1af294a03e2ae84da69fa44c5cb9df2882f767f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
module ActiveSupport
  module NumberHelper
    class NumberToPercentageConverter < NumberConverter # :nodoc:
      self.namespace = :percentage

      def convert
        rounded_number = NumberToRoundedConverter.convert(number, options)
        options[:format].gsub(/%n/, rounded_number)
      end
    end
  end
end