method
parameterize
parameterize(string, separator: "-", preserve_case: false)
public
Replaces special characters in a string so that it may be used as part of a ‘pretty’ URL.
parameterize("Donald E. Knuth") # => "donald-e-knuth" parameterize("^trés|Jolie-- ") # => "tres-jolie"
To use a custom separator, override the `separator` argument.
parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth" parameterize("^trés|Jolie-- ", separator: '_') # => "tres_jolie"
To preserve the case of the characters in a string, use the `preserve_case` argument.
parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth" parameterize("^trés|Jolie-- ", preserve_case: true) # => "tres-Jolie"