Method: Ebay::Inflections#underscore

Defined in:
lib/ebay/inflections.rb

#underscore(camel_cased_word) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/ebay/inflections.rb', line 21

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