Method: String#titleize
- Defined in:
- lib/sequel/extensions/inflector.rb
#titleize ⇒ Object Also known as: titlecase
Capitalizes all the words and replaces some characters in the string to create a nicer looking title. Titleize is meant for creating pretty output.
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"
243 244 245 |
# File 'lib/sequel/extensions/inflector.rb', line 243 def titleize underscore.humanize.gsub(/\b([a-z])/){|x| x[-1..-1].upcase} end |