module

ActiveSupport::NumberHelper

Number Helper

Provides methods for formatting numbers into currencies, percentages, phone numbers, and more.

Example usage in a class:

class Topic
  include ActiveSupport::NumberHelper

  def price
    number_to_currency(@price)
  end
end

Example usage in a module:

require "active_support/number_helper"

module NumberFormatting
  def format_price(price)
    ActiveSupport::NumberHelper.number_to_currency(price)
  end
end

Files

  • activesupport/lib/active_support/number_helper.rb
  • activesupport/lib/active_support/number_helper/number_converter.rb
  • activesupport/lib/active_support/number_helper/number_to_currency_converter.rb
  • activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb
  • activesupport/lib/active_support/number_helper/number_to_human_converter.rb
  • activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb
  • activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb
  • activesupport/lib/active_support/number_helper/number_to_phone_converter.rb
  • activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb
  • activesupport/lib/active_support/number_helper/rounding_helper.rb