Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/string_extensions.rb

Instance Method Summary collapse

Instance Method Details

#urlizeObject

Convert an arbitrary string into a format suitable for use in a URL

  • Replaces spaces with dashes

  • Converts to all lower-case

  • Removes all characters except alphabetic and numeric



7
8
9
# File 'lib/string_extensions.rb', line 7

def urlize
  self.gsub(" ","-").downcase.gsub(/[^a-z0-9-]/,"")
end