Method: Cell::Util::Inflector.underscore
- Defined in:
- lib/cell/util.rb
.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 |