Class: Jat::LowerCamelCaseTransformation

Inherits:
Object
  • Object
show all
Defined in:
lib/jat/plugins/base/base_lower_camel_case/base_lower_camel_case.rb

Constant Summary collapse

SEPARATOR =
"_"

Class Method Summary collapse

Class Method Details

.call(string) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/jat/plugins/base/base_lower_camel_case/base_lower_camel_case.rb', line 27

def self.call(string)
  first_word, *others = string.to_s.split(SEPARATOR)

  first_word[0] = first_word[0].downcase
  last_words = others.each(&:capitalize!).join

  :"#{first_word}#{last_words}"
end