Method: String#underscore
- Defined in:
- lib/juicer/ext/string.rb
#underscore ⇒ Object
Turn a camelcase string into underscore string
42 43 44 |
# File 'lib/juicer/ext/string.rb', line 42 def underscore self.split(/([A-Z][^A-Z]*)/).find_all { |str| str != "" }.join("_").downcase end |