Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/rebrandly.rb
Instance Method Summary collapse
Instance Method Details
#camelize ⇒ Object
37 38 39 |
# File 'lib/rebrandly.rb', line 37 def camelize self.split('_').collect(&:capitalize).join end |
#lower_camelize ⇒ Object
41 42 43 44 |
# File 'lib/rebrandly.rb', line 41 def lower_camelize res = self.camelize res[0].downcase + res[1..-1] end |
#underscore ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/rebrandly.rb', line 29 def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |