Method: String#titleize

Defined in:
lib/awestruct/util/inflector.rb

#titleizeObject 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"


227
228
229
# File 'lib/awestruct/util/inflector.rb', line 227

def titleize
  underscore.humanize.gsub(/\b([a-z])/){|x| x[-1..-1].upcase}
end