Class: String

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

Instance Method Summary collapse

Instance Method Details

#camelizeObject

Reshape a string



6
7
8
9
10
11
12
# File 'lib/utils/string.rb', line 6

def camelize
  return self.strip unless self =~ /_/
  x = self.strip.split( '_' )
  s = x.shift
  s << ( x.map{|seg| seg.capitalize }.join('') )
  s
end