Class: Cell::Util::Inflector

Inherits:
Object
  • Object
show all
Defined in:
lib/cell/util.rb

Class Method Summary collapse

Class Method Details

.underscore(constant) ⇒ Object

copied from ActiveSupport.



8
9
10
11
12
13
14
# File 'lib/cell/util.rb', line 8

def self.underscore(constant)
  constant.gsub(/::/, '/').
  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
  gsub(/([a-z\d])([A-Z])/,'\1_\2').
  tr("-", "_").
  downcase
end