Module: RestAPIBuilder::Helpers::StringHelper

Defined in:
lib/rest_api_builder/helpers/string_helper.rb

Class Method Summary collapse

Class Method Details

.camelize(string) ⇒ Object



7
8
9
10
11
12
# File 'lib/rest_api_builder/helpers/string_helper.rb', line 7

def camelize(string)
  string
    .sub(/^[a-z\d]*/, &:capitalize)
    .gsub(/(?:_|(\/))([a-z\d]*)/) { "#{Regexp.last_match(1)}#{Regexp.last_match(2).capitalize}" }
    .gsub("/", "::")
end