aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorPol Llovet <pol.llovet@gmail.com>2011-07-09 12:35:16 -0600
committerPol Llovet <pol.llovet@gmail.com>2011-07-09 12:35:16 -0600
commitea16e0f716d150af98dbd612a8c730dad5bb2924 (patch)
tree5a342c0208b8acd1695fbdcd7447b94d14e04e56 /activesupport
parent2beea3b249763edcb133c1b7078958ef14815812 (diff)
downloadrails-ea16e0f716d150af98dbd612a8c730dad5bb2924.tar.gz
rails-ea16e0f716d150af98dbd612a8c730dad5bb2924.tar.bz2
rails-ea16e0f716d150af98dbd612a8c730dad5bb2924.zip
Add more examples to #titleize
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/inflector/methods.rb6
1 files changed, 4 insertions, 2 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