Created
August 27, 2019 12:18
-
-
Save blitzblade/25911cf2b8121999506a425a4952f217 to your computer and use it in GitHub Desktop.
[Titleize hyphenated names in ruby] #titleize #capitalize #ruby #rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def titleizer(name) | |
name.split.map{ |part| part.split("-").map{ |p| p.capitalize }.join("-") }.join(" ") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment