Method: String#underscore
- Defined in:
- lib/strokedb/core_ext/string.rb
#underscore ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/strokedb/core_ext/string.rb', line 51 def underscore self.to_s.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |