diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-16 08:40:46 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-16 08:40:46 +0900 |
commit | 26b5e6284703432fc9022b215a221037fc05920d (patch) | |
tree | 81f294d99fd48f62d66093bcc3e8d23c63dcd6d0 | |
parent | a47c84d584777238a6955e3a08436577c471af0f (diff) | |
parent | 40ef8a12ed2c0d293e77aa5a5bcec68aee9b998e (diff) | |
download | rails-26b5e6284703432fc9022b215a221037fc05920d.tar.gz rails-26b5e6284703432fc9022b215a221037fc05920d.tar.bz2 rails-26b5e6284703432fc9022b215a221037fc05920d.zip |
Merge pull request #35634 from sharang-d/update-parameterize-docs
Update docs for 'parameterize()' [ci skip]
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/inflections.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/inflector/transliterate.rb | 14 |
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) |