Module: TextFilter
- Defined in:
- lib/kody/modules.rb
Instance Method Summary collapse
Instance Method Details
#capitalize_first(input) ⇒ Object
5 6 7 |
# File 'lib/kody/modules.rb', line 5 def capitalize_first(input) input[0].upcase + input[1..-1] end |
#underscore ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/kody/modules.rb', line 9 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 |