aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorSharang Dashputre <sharang.d@gmail.com>2019-03-16 03:24:26 +0530
committerSharang Dashputre <sharang.d@gmail.com>2019-03-16 03:24:26 +0530
commit40ef8a12ed2c0d293e77aa5a5bcec68aee9b998e (patch)
tree1dcd699ed8a9cfee8c89092f10285afa4284bef1 /activesupport
parent233927965d0bd79752274bbc7394d21efeda54c0 (diff)
downloadrails-40ef8a12ed2c0d293e77aa5a5bcec68aee9b998e.tar.gz
rails-40ef8a12ed2c0d293e77aa5a5bcec68aee9b998e.tar.bz2
rails-40ef8a12ed2c0d293e77aa5a5bcec68aee9b998e.zip
Update docs for 'parameterize()' [ci skip]
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/string/inflections.rb2
-rw-r--r--activesupport/lib/active_support/inflector/transliterate.rb14
2 files changed, 10 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb
index e63b38b227..5eb8d9f99b 100644
--- a/activesupport/lib/active_support/core_ext/string/inflections.rb
+++ b/activesupport/lib/active_support/core_ext/string/inflections.rb
@@ -165,7 +165,7 @@ class String
# If the optional parameter +locale+ is specified,
# the word will be parameterized as a word of that language.
# By default, this parameter is set to <tt>nil</tt> and it will use
- # configured I18n.locale
+ # the configured <tt>I18n.locale</tt>.
#
# class Person
# def to_param
diff --git a/activesupport/lib/active_support/inflector/transliterate.rb b/activesupport/lib/active_support/inflector/transliterate.rb
index fe778ff0e7..ec6e9ccb59 100644
--- a/activesupport/lib/active_support/inflector/transliterate.rb
+++ b/activesupport/lib/active_support/inflector/transliterate.rb
@@ -74,8 +74,8 @@ module ActiveSupport
#
# To use a custom separator, override the +separator+ argument.
#
- # parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth"
- # parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie"
+ # parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth"
+ # parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie"
#
# To preserve the case of the characters in a string, use the +preserve_case+ argument.
#
@@ -84,10 +84,14 @@ module ActiveSupport
#
# It preserves dashes and underscores unless they are used as separators:
#
- # parameterize("^très|Jolie__ ") # => "tres-jolie__"
- # parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--"
- # parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--"
+ # parameterize("^très|Jolie__ ") # => "tres-jolie__"
+ # parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--"
+ # parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--"
#
+ # If the optional parameter +locale+ is specified,
+ # the word will be parameterized as a word of that language.
+ # By default, this parameter is set to <tt>nil</tt> and it will use
+ # the configured <tt>I18n.locale<tt>.
def parameterize(string, separator: "-", preserve_case: false, locale: nil)
# Replace accented chars with their ASCII equivalents.
parameterized_string = transliterate(string, locale: locale)