instance method
titleize
Ruby on Rails 3.2.22.5
Since v3.0.20Signature
titleize()
Capitalizes the first letter of every word, when possible.
Example:
"ÉL QUE SE ENTERÓ".mb_chars.titleize # => "Él Que Se Enteró" "日本語".mb_chars.titleize # => "日本語"
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 368
def titleize
chars(downcase.to_s.gsub(/\b('?[\S])/u) { Unicode.apply_mapping $1, :uppercase_mapping })
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 368
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars