aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-08-20 10:49:54 +0900
committerGitHub <noreply@github.com>2018-08-20 10:49:54 +0900
commit103b02f1524beaa5c773f95dce6892dad3805d4f (patch)
tree360e060d3c11624941d705c172e9b735436e747b /activesupport
parent2247077b0bed3423c8b1a9529d2cb89482f0019c (diff)
parent6e1a536ad46fcd26f90ce2c0c47c66df45e67012 (diff)
downloadrails-103b02f1524beaa5c773f95dce6892dad3805d4f.tar.gz
rails-103b02f1524beaa5c773f95dce6892dad3805d4f.tar.bz2
rails-103b02f1524beaa5c773f95dce6892dad3805d4f.zip
Merge pull request #31132 from emaxi/feature/add-missing-documentation-option-to-number-to-currency
Add missing documentation option to number_to_currency [ci skip]
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/number_helper.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/number_helper.rb b/activesupport/lib/active_support/number_helper.rb
index 8fd6e932f1..c75ad52b0c 100644
--- a/activesupport/lib/active_support/number_helper.rb
+++ b/activesupport/lib/active_support/number_helper.rb
@@ -85,6 +85,9 @@ module ActiveSupport
# number given by <tt>:format</tt>). Accepts the same fields
# than <tt>:format</tt>, except <tt>%n</tt> is here the
# absolute value of the number.
+ # * <tt>:strip_insignificant_zeros</tt> - If +true+ removes
+ # insignificant zeros after the decimal separator (defaults to
+ # +false+).
#
# ==== Examples
#
@@ -100,6 +103,8 @@ module ActiveSupport
# # => "&pound;1234567890,50"
# number_to_currency(1234567890.50, unit: '&pound;', separator: ',', delimiter: '', format: '%n %u')
# # => "1234567890,50 &pound;"
+ # number_to_currency(1234567890.50, strip_insignificant_zeros: true)
+ # # => "$1,234,567,890.5"
def number_to_currency(number, options = {})
NumberToCurrencyConverter.convert(number, options)
end