1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

s/seperator/separator/g

This commit is contained in:
Akira Matsuda 2015-09-18 18:41:26 +09:00
parent cd89e5c8c7
commit 44e5ebf688

View file

@ -75,15 +75,15 @@ module ActiveSupport
parameterized_string.gsub!(/[^a-z0-9\-_]+/i, sep)
unless sep.nil? || sep.empty?
if sep == "-".freeze
re_duplicate_seperator = /-{2,}/
re_duplicate_separator = /-{2,}/
re_leading_trailing_separator = /^-|-$/i
else
re_sep = Regexp.escape(sep)
re_duplicate_seperator = /#{re_sep}{2,}/
re_duplicate_separator = /#{re_sep}{2,}/
re_leading_trailing_separator = /^#{re_sep}|#{re_sep}$/i
end
# No more than one of the separator in a row.
parameterized_string.gsub!(re_duplicate_seperator, sep)
parameterized_string.gsub!(re_duplicate_separator, sep)
# Remove leading/trailing separator.
parameterized_string.gsub!(re_leading_trailing_separator, ''.freeze)
end