Module: FreshdeskApiclient::Utils::Camelizable

Defined in:
lib/freshdesk_apiclient/utils/camelizable.rb

Class Method Summary collapse

Class Method Details

.camelize(term) ⇒ Object



5
6
7
8
# File 'lib/freshdesk_apiclient/utils/camelizable.rb', line 5

def self.camelize(term)
  string = term.to_s
  format string
end

.format(string) ⇒ Object



10
11
12
13
14
# File 'lib/freshdesk_apiclient/utils/camelizable.rb', line 10

def self.format(string)
  string = string.sub(/^[a-z\d]*/) { $&.capitalize }
  string.gsub!(%r{(?:_|(/))([a-z\d]*)}) { $2.capitalize }
  string
end