Class: Model::Helper
- Inherits:
-
Object
- Object
- Model::Helper
- Defined in:
- lib/services/helper.rb
Class Method Summary collapse
-
.underscore(str) ⇒ Object
convert string to underscore case.
Class Method Details
.underscore(str) ⇒ Object
convert string to underscore case
4 5 6 7 8 9 10 |
# File 'lib/services/helper.rb', line 4 def self.underscore(str) str.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |