I created a web framework that uses the following function:
def to_class(text)
text.capitalize
text.gsub(/(_|-)/, '')
end
To include directory names that are snake_casedor hyphen-casedin PascalCasedclass names for your project.
The problem is that the function removes only _and -not use the next letter. Using .capitalizeor .upcase, is there a way to make your names the snake/hyphen_/-casedcorrect class names PascalCased?
beakr source
share