Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/core-ext/string.rb

Instance Method Summary collapse

Instance Method Details

#camelize(first_letter_in_uppercase = true) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/core-ext/string.rb', line 2

def camelize(first_letter_in_uppercase = true)
  if first_letter_in_uppercase
    self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
  else
    self[0].chr.downcase + camelize[1..-1]
  end
end