Skip to content

Instantly share code, notes, and snippets.

@blitzblade
Created August 27, 2019 12:18
Show Gist options
  • Save blitzblade/25911cf2b8121999506a425a4952f217 to your computer and use it in GitHub Desktop.
Save blitzblade/25911cf2b8121999506a425a4952f217 to your computer and use it in GitHub Desktop.
[Titleize hyphenated names in ruby] #titleize #capitalize #ruby #rails
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