Method: Aether::String#camelcase

Defined in:
lib/aetherg/string.rb

#camelcaseObject



3
4
5
6
7
8
9
10
11
# File 'lib/aetherg/string.rb', line 3

def camelcase
  return self.gsub(/^./) { |l| l.capitalize } if !match(/[_-]/)
  altered_self = self.downcase.capitalize
  altered_self.scan(/[_-][a-zA-Z]/).each do |match|
    altered_self.gsub!(match, match[1].upcase)
  end

  altered_self
end