Class: Knot::Util
- Inherits:
-
Object
- Object
- Knot::Util
- Defined in:
- lib/knot/util.rb
Class Method Summary collapse
Class Method Details
.to_snake(str) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/knot/util.rb', line 3 def self.to_snake(str) str.to_s.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |