Module: Archfiend::String::Camelize
- Defined in:
- lib/archfiend/core_ext/string/camelize.rb
Instance Method Summary collapse
-
#camelize ⇒ String
rubocop:disable Style/PerlBackrefs.
Instance Method Details
#camelize ⇒ String
rubocop:disable Style/PerlBackrefs
6 7 8 9 10 11 |
# File 'lib/archfiend/core_ext/string/camelize.rb', line 6 def camelize string = sub(/^[a-z\d]*/, &:capitalize) string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" } string.gsub!('/'.freeze, '::'.freeze) string end |