Module: ActiveSupport::Inflector
Instance Method Summary collapse
-
#titleize(title) ⇒ Object
(also: #titlecase)
Capitalizes most words to create a nicer looking title string.
Instance Method Details
#titleize(title) ⇒ Object Also known as: titlecase
Capitalizes most words to create a nicer looking title string.
The list of “small words” which are not capped comes from the New York Times Manual of Style, plus ‘vs’ and ‘v’.
This replaces the default Rails titleize. Like the default, it uses Inflector.underscore and Inflector.humanize to convert underscored_names and CamelCaseNames to a more human form.
titleize is also aliased as titlecase.
"notes on an active_record" # => "Notes on an Active Record"
"the GoodGerman" # => "The Good German"
112 113 114 |
# File 'lib/titleize.rb', line 112 def titleize(title) Titleize.titleize(ActiveSupport::Inflector.humanize(ActiveSupport::Inflector.underscore(title))) end |