Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/extensions/string.rb
Instance Method Summary collapse
Instance Method Details
#camelize(first_letter_in_uppercase = true) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/extensions/string.rb', line 3 def camelize(first_letter_in_uppercase = true) first_letter_in_uppercase = false if first_letter_in_uppercase == :lower if first_letter_in_uppercase self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } else self.first + self.camelize[1..-1] end end |