Module: Scarpe::Components::StringHelpers

Defined in:
scarpe-components/lib/scarpe/components/string_helpers.rb

Class Method Summary collapse

Class Method Details

.camelize(string) ⇒ Object

Cut down from Rails camelize



6
7
8
9
# File 'scarpe-components/lib/scarpe/components/string_helpers.rb', line 6

def self.camelize(string)
  string = string.sub(/^[a-z\d]*/, &:capitalize)
  string.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{::Regexp.last_match(1)}#{::Regexp.last_match(2).capitalize}" }
end