Last active
May 21, 2021 11:18
-
-
Save maasha/27a14fd89a9f03c031d2a9723464f6dc to your computer and use it in GitHub Desktop.
golf me
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 camel_case_to_title(str) | |
return 'eClass' if str == 'e_class' | |
return 'ID' if str == 'id' | |
word_parts = [] | |
str.split('_').each do |word| | |
word_parts << word.capitalize unless word == 'id' | |
end | |
word_parts.join(' ') | |
end |
adam12
commented
May 21, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment