mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fix broken format in ActionView::Helpers::NumberHelper [ci skip]
This commit is contained in:
parent
8e17908d67
commit
64d8cdee31
1 changed files with 25 additions and 0 deletions
|
@ -28,6 +28,8 @@ module ActionView
|
|||
# Formats a +number+ into a US phone number (e.g., (555)
|
||||
# 123-9876). You can customize the format in the +options+ hash.
|
||||
#
|
||||
# ==== Options
|
||||
#
|
||||
# * <tt>:area_code</tt> - Adds parentheses around the area code.
|
||||
# * <tt>:delimiter</tt> - Specifies the delimiter to use
|
||||
# (defaults to "-").
|
||||
|
@ -38,6 +40,8 @@ module ActionView
|
|||
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
||||
# the argument is invalid.
|
||||
#
|
||||
# ==== Examples
|
||||
#
|
||||
# number_to_phone(5551234) # => 555-1234
|
||||
# number_to_phone("5551234") # => 555-1234
|
||||
# number_to_phone(1235551234) # => 123-555-1234
|
||||
|
@ -61,6 +65,8 @@ module ActionView
|
|||
# Formats a +number+ into a currency string (e.g., $13.65). You
|
||||
# can customize the format in the +options+ hash.
|
||||
#
|
||||
# ==== Options
|
||||
#
|
||||
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
||||
# (defaults to current locale).
|
||||
# * <tt>:precision</tt> - Sets the level of precision (defaults
|
||||
|
@ -82,6 +88,8 @@ module ActionView
|
|||
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
||||
# the argument is invalid.
|
||||
#
|
||||
# ==== Examples
|
||||
#
|
||||
# number_to_currency(1234567890.50) # => $1,234,567,890.50
|
||||
# number_to_currency(1234567890.506) # => $1,234,567,890.51
|
||||
# number_to_currency(1234567890.506, precision: 3) # => $1,234,567,890.506
|
||||
|
@ -108,6 +116,7 @@ module ActionView
|
|||
# Formats a +number+ as a percentage string (e.g., 65%). You can
|
||||
# customize the format in the +options+ hash.
|
||||
#
|
||||
# ==== Options
|
||||
#
|
||||
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
||||
# (defaults to current locale).
|
||||
|
@ -128,6 +137,8 @@ module ActionView
|
|||
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
||||
# the argument is invalid.
|
||||
#
|
||||
# ==== Examples
|
||||
#
|
||||
# number_to_percentage(100) # => 100.000%
|
||||
# number_to_percentage("98") # => 98.000%
|
||||
# number_to_percentage(100, precision: 0) # => 100%
|
||||
|
@ -151,6 +162,8 @@ module ActionView
|
|||
# (e.g., 12,324). You can customize the format in the +options+
|
||||
# hash.
|
||||
#
|
||||
# ==== Options
|
||||
#
|
||||
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
||||
# (defaults to current locale).
|
||||
# * <tt>:delimiter</tt> - Sets the thousands delimiter (defaults
|
||||
|
@ -160,6 +173,8 @@ module ActionView
|
|||
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
||||
# the argument is invalid.
|
||||
#
|
||||
# ==== Examples
|
||||
#
|
||||
# number_with_delimiter(12345678) # => 12,345,678
|
||||
# number_with_delimiter("123456") # => 123,456
|
||||
# number_with_delimiter(12345678.05) # => 12,345,678.05
|
||||
|
@ -185,6 +200,8 @@ module ActionView
|
|||
# +:significant+ is +false+, and 5 if +:significant+ is +true+).
|
||||
# You can customize the format in the +options+ hash.
|
||||
#
|
||||
# ==== Options
|
||||
#
|
||||
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
||||
# (defaults to current locale).
|
||||
# * <tt>:precision</tt> - Sets the precision of the number
|
||||
|
@ -202,6 +219,8 @@ module ActionView
|
|||
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
||||
# the argument is invalid.
|
||||
#
|
||||
# ==== Examples
|
||||
#
|
||||
# number_with_precision(111.2345) # => 111.235
|
||||
# number_with_precision(111.2345, precision: 2) # => 111.23
|
||||
# number_with_precision(13, precision: 5) # => 13.00000
|
||||
|
@ -233,6 +252,8 @@ module ActionView
|
|||
# See <tt>number_to_human</tt> if you want to pretty-print a
|
||||
# generic number.
|
||||
#
|
||||
# ==== Options
|
||||
#
|
||||
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
||||
# (defaults to current locale).
|
||||
# * <tt>:precision</tt> - Sets the precision of the number
|
||||
|
@ -252,6 +273,8 @@ module ActionView
|
|||
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
||||
# the argument is invalid.
|
||||
#
|
||||
# ==== Examples
|
||||
#
|
||||
# number_to_human_size(123) # => 123 Bytes
|
||||
# number_to_human_size(1234) # => 1.21 KB
|
||||
# number_to_human_size(12345) # => 12.1 KB
|
||||
|
@ -324,6 +347,8 @@ module ActionView
|
|||
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
||||
# the argument is invalid.
|
||||
#
|
||||
# ==== Examples
|
||||
#
|
||||
# number_to_human(123) # => "123"
|
||||
# number_to_human(1234) # => "1.23 Thousand"
|
||||
# number_to_human(12345) # => "12.3 Thousand"
|
||||
|
|
Loading…
Reference in a new issue