Method: String#underscore
- Defined in:
- lib/scrappy/support.rb
#underscore ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/scrappy/support.rb', line 25 def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). gsub(/\s+/,"_"). downcase end |