diff options
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/inflector/methods.rb | 6 | ||||
-rw-r--r-- | activesupport/lib/active_support/multibyte/chars.rb | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 3d28d33f40..423b5abd20 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -118,8 +118,10 @@ module ActiveSupport # +titleize+ is also aliased as as +titlecase+. # # Examples: - # "man from the boondocks".titleize # => "Man From The Boondocks" - # "x-men: the last stand".titleize # => "X Men: The Last Stand" + # "man from the boondocks".titleize # => "Man From The Boondocks" + # "x-men: the last stand".titleize # => "X Men: The Last Stand" + # "TheManWithoutAPast".titleize # => "The Man Without A Past" + # "raiders_of_the_lost_ark".titleize # => "Raiders Of The Lost Ark" def titleize(word) humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize } end diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index f9607f1aaf..b78d92f599 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -331,8 +331,7 @@ module ActiveSupport #:nodoc: # when the storage for a string is limited for some reason. # # Example: - # s = 'こんにちは' - # s.mb_chars.limit(7) # => "こに" + # 'こんにちは'.mb_chars.limit(7).to_s # => "こん" def limit(limit) slice(0...translate_offset(limit)) end |