Module: DeepCover::Tools::Camelize

Extended by:
Camelize
Included in:
Camelize
Defined in:
lib/deep_cover/tools/camelize.rb

Instance Method Summary collapse

Instance Method Details

#camelize(string) ⇒ Object

Poor man’s camelize. ‘an_example’ => ‘AnExample’



8
9
10
# File 'lib/deep_cover/tools/camelize.rb', line 8

def camelize(string)
  string.to_s.gsub(/([a-z\d]*)[_?!]?/) { Regexp.last_match(1).capitalize }
end