Billy Logan Billy Logan - 10 months ago 46
Ruby Question

How to convert string to UpperCamelCase in Ruby?

I want to turn string into CamelCase fashion In Ruby. The question also applies to words with underscores.

For example:

"human" => "Human"
"little_human" => "LittleHuman"

How can I do this?


In rails there is a camelize method. In ruby you can write the method on your own. Something like

def camelize(s)