Class: String

— http://api.rubyonrails.com/classes/Inflector.html#M001621 ++

Public Visibility

Public Instance Method Summary

#underscore

Public Instance Method Details

underscore

public underscore
[View source]


9
10
11
12
13
14
15
# File 'lib/celerity/extra/method_generator.rb', line 9

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