aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorप्रथमेश Sonpatki <csonpatki@gmail.com>2016-12-17 20:32:02 +0530
committerGitHub <noreply@github.com>2016-12-17 20:32:02 +0530
commite3802f961756aac58d9b4392bf2e73813b09f469 (patch)
tree92a0434bbcb98b4c86ed5c5e11e60845c4fc6340
parent86ca5b254109e64edeb6e142e656b8a8c247cac8 (diff)
parent2ebed7a36e74ab4609d20152a09b69abf7b94397 (diff)
downloadrails-e3802f961756aac58d9b4392bf2e73813b09f469.tar.gz
rails-e3802f961756aac58d9b4392bf2e73813b09f469.tar.bz2
rails-e3802f961756aac58d9b4392bf2e73813b09f469.zip
Merge pull request #27393 from elpic/master
Add missing option on number helper
-rw-r--r--actionview/lib/action_view/helpers/number_helper.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/actionview/lib/action_view/helpers/number_helper.rb b/actionview/lib/action_view/helpers/number_helper.rb
index 75b898c3e9..9e80f0b2ee 100644
--- a/actionview/lib/action_view/helpers/number_helper.rb
+++ b/actionview/lib/action_view/helpers/number_helper.rb
@@ -171,6 +171,9 @@ module ActionView
# to ",").
# * <tt>:separator</tt> - Sets the separator between the
# fractional and integer digits (defaults to ".").
+ # * <tt>:delimiter_pattern</tt> - Sets a custom regular expression used for
+ # deriving the placement of delimiter. Helpful when using currency formats
+ # like INR.
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
# the argument is invalid.
#
@@ -187,6 +190,9 @@ module ActionView
# number_with_delimiter(98765432.98, delimiter: " ", separator: ",")
# # => 98 765 432,98
#
+ # number_with_delimiter("123456.78",
+ # delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/) # => "1,23,456.78"
+ #
# number_with_delimiter("112a", raise: true) # => raise InvalidNumberError
def number_with_delimiter(number, options = {})
delegate_number_helper_method(:number_to_delimited, number, options)