Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/kody/string.rb
Instance Method Summary collapse
Instance Method Details
#capitalize_first(input) ⇒ Object
3 4 5 |
# File 'lib/kody/string.rb', line 3 def capitalize_first(input) input[0].upcase + input[1..-1] end |
#underscore ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/kody/string.rb', line 7 def underscore self. gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). gsub(/([A-Z\d])([A-Z])/,'\1_\2'). gsub(/([A-Z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |