module

ActionView::Helpers::NumberHelper

Provides methods for converting numbers into formatted strings. Methods are provided for phone numbers, currency, percentage, precision, positional notation, file size and pretty printing.

Most methods expect a number argument, and will return it unchanged if can’t be converted into a valid number.

Constants

DECIMAL_UNITS = {0 => :unit, 1 => :ten, 2 => :hundred, 3 => :thousand, 6 => :million, 9 => :billion, 12 => :trillion, 15 => :quadrillion,\n-1 => :deci, -2 => :centi, -3 => :mili, -6 => :micro, -9 => :nano, -12 => :pico, -15 => :femto}.freeze

DEFAULT_CURRENCY_VALUES = { :format => "%u%n", :negative_format => "-%u%n", :unit => "$", :separator => ".", :delimiter => ",",\n:precision => 2, :significant => false, :strip_insignificant_zeros => false }

STORAGE_UNITS = [:byte, :kb, :mb, :gb, :tb].freeze

Files

  • actionpack/lib/action_view/helpers/number_helper.rb

Nested classes and modules