Class: String

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

Overview

this is a monkey patching over the String class to bring the camelcase method from rails

Instance Method Summary collapse

Instance Method Details

#camelizeObject

the famous camelize method so useful in metaprogramming



6
7
8
9
# File 'lib/cogbot/utils.rb', line 6

def camelize
  self.downcase!
  self.gsub!(/(?:_| )?(.)([^_ ]*)/) { "#{$1.upcase}#{$2}" }
end