Class: Object

Inherits:
BasicObject
Defined in:
lib/ruboto/core_ext/object.rb

Instance Method Summary collapse

Instance Method Details

#underscore(camel_cased_word) ⇒ Object

active_support/inflector.rb



3
4
5
6
7
8
9
# File 'lib/ruboto/core_ext/object.rb', line 3

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