lib/rdio/utils.rb
# Makes an underscored, lowercase form of the string.
# Based on ActiveSupport's Infector#underscore
Makes an underscored, lowercase form of the string.
Based on ActiveSupport's Infector#underscore
Makes an underscored lowercase form of the string . Based on ActiveSupport ' s Infector#underscore
def underscore_string(str)
      word = str.to_s.dup
      word.gsub!(' ', '_')
      word.gsub!(/::/, '/')
      word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
      word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
      word.tr!('-', '_')
      word.squeeze!('_')
      word.downcase!
      word
    end
def underscore_string ( str ) word = str . to_s . dup word . gsub! ( ' ' , '_' ) word . gsub! ( / :: / , '/' ) word . gsub! ( / ([A-Z \d ]+)([A-Z][a-z]) / , '\1_\2' ) word . gsub! ( / ([a-z \d ])([A-Z]) / , '\1_\2' ) word . tr! ( '-' , '_' ) word . squeeze! ( '_' ) word . downcase! word end
Makes an underscored, lowercase form of the string.
Makes an underscored lowercase form of the string .
str
<not_specific>