mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Add more examples to #titleize
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user