Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/string_extensions.rb
Instance Method Summary collapse
-
#urlize ⇒ Object
Convert an arbitrary string into a format suitable for use in a URL.
Instance Method Details
#urlize ⇒ Object
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 |