Method: Me2API::Model#underscore

Defined in:
lib/me2api/model.rb

#underscore(str) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/me2api/model.rb', line 48

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