Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/contxtlservice.rb

Instance Method Summary collapse

Instance Method Details

#camel_case_to_underscoreObject



161
162
163
# File 'lib/contxtlservice.rb', line 161

def camel_case_to_underscore
	( gsub( /(.)([A-Z])/ ) { $1 + '_' + $2.downcase } ).downcase
end

#underscore_to_camel_caseObject



167
168
169
# File 'lib/contxtlservice.rb', line 167

def underscore_to_camel_case
	capitalize.gsub( /_([a-zA-Z0-9]+)/ ) { |s| s[1,s.size - 1].capitalize }
end