Method: Thor::Util.camel_case

Defined in:
lib/thor/util.rb

.camel_case(str) ⇒ Object

Receives a string and convert it to camel case. camel_case returns CamelCase.

Parameters

String

Returns

String



104
105
106
107
# File 'lib/thor/util.rb', line 104

def camel_case(str)
  return str if str !~ /_/ && str =~ /[A-Z]+.*/
  str.split("_").map(&:capitalize).join
end