提交 294ddff5 编写于 作者: A Akshay Vishnoi

[ci skip] Add Docs for strip_insignificant_zeros option in number helpers

上级 3681e1ac
......@@ -266,14 +266,8 @@ def number_with_precision(number, options = {})
# number_to_human_size(1234567, precision: 2) # => 1.2 MB
# number_to_human_size(483989, precision: 2) # => 470 KB
# number_to_human_size(1234567, precision: 2, separator: ',') # => 1,2 MB
#
# Non-significant zeros after the fractional separator are
# stripped out by default (set
# <tt>:strip_insignificant_zeros</tt> to +false+ to change
# that):
#
# number_to_human_size(1234567890123, precision: 5) # => "1.1228 TB"
# number_to_human_size(524288000, precision: 5) # => "500 MB"
# number_to_human_size(1234567890123, precision: 5) # => "1.1228 TB"
# number_to_human_size(524288000, precision: 5) # => "500 MB"
def number_to_human_size(number, options = {})
delegate_number_helper_method(:number_to_human_size, number, options)
end
......@@ -343,11 +337,15 @@ def number_to_human_size(number, options = {})
# separator: ',',
# significant: false) # => "1,2 Million"
#
# number_to_human(500000000, precision: 5) # => "500 Million"
# number_to_human(12345012345, significant: false) # => "12.345 Billion"
#
# Non-significant zeros after the decimal separator are stripped
# out by default (set <tt>:strip_insignificant_zeros</tt> to
# +false+ to change that):
# number_to_human(12345012345, significant: false) # => "12.345 Billion"
# number_to_human(500000000, precision: 5) # => "500 Million"
#
# number_to_human(12.00001) # => "12"
# number_to_human(12.00001, strip_insignificant_zeros: false) # => "12.0"
#
# ==== Custom Unit Quantifiers
#
......
......@@ -232,12 +232,8 @@ def number_to_rounded(number, options = {})
# number_to_human_size(1234567, precision: 2) # => 1.2 MB
# number_to_human_size(483989, precision: 2) # => 470 KB
# number_to_human_size(1234567, precision: 2, separator: ',') # => 1,2 MB
#
# Non-significant zeros after the fractional separator are stripped out by
# default (set <tt>:strip_insignificant_zeros</tt> to +false+ to change that):
#
# number_to_human_size(1234567890123, precision: 5) # => "1.1228 TB"
# number_to_human_size(524288000, precision: 5) # => "500 MB"
# number_to_human_size(1234567890123, precision: 5) # => "1.1228 TB"
# number_to_human_size(524288000, precision: 5) # => "500 MB"
def number_to_human_size(number, options = {})
NumberToHumanSizeConverter.convert(number, options)
end
......@@ -305,12 +301,15 @@ def number_to_human_size(number, options = {})
# separator: ',',
# significant: false) # => "1,2 Million"
#
# number_to_human(500000000, precision: 5) # => "500 Million"
# number_to_human(12345012345, significant: false) # => "12.345 Billion"
#
# Non-significant zeros after the decimal separator are stripped
# out by default (set <tt>:strip_insignificant_zeros</tt> to
# +false+ to change that):
#
# number_to_human(12345012345, significant: false) # => "12.345 Billion"
# number_to_human(500000000, precision: 5) # => "500 Million"
# number_to_human(12.00001) # => "12"
# number_to_human(12.00001, strip_insignificant_zeros: false) # => "12.0"
#
# ==== Custom Unit Quantifiers
#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册