Class: Stingray::Junk
- Inherits:
-
Object
- Object
- Stingray::Junk
- Defined in:
- lib/stingray/junk.rb
Class Method Summary collapse
Class Method Details
.constify(str) ⇒ Object
12 13 14 |
# File 'lib/stingray/junk.rb', line 12 def self.constify(str) str.gsub(/\./, '').gsub(/_/, '') end |
.snakify(str) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/stingray/junk.rb', line 3 def self.snakify(str) str.gsub(/::/, '/'). gsub(/\./, '_'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |