Utils.slugify: Don't create new objects when gsubbing
This commit is contained in:
parent
b62415019b
commit
9f5835871b
|
@ -111,11 +111,13 @@ module Jekyll
|
||||||
# hyphen.
|
# hyphen.
|
||||||
def slugify(string)
|
def slugify(string)
|
||||||
unless string.nil?
|
unless string.nil?
|
||||||
# Replace each non-alphanumeric character sequence with a hyphen
|
string \
|
||||||
slug = string.gsub(/[^a-z0-9]+/i, '-')
|
# Replace each non-alphanumeric character sequence with a hyphen
|
||||||
# Remove leading/trailing hyphen
|
.gsub(/[^a-z0-9]+/i, '-') \
|
||||||
slug.gsub!(/^\-|\-$/i, '')
|
# Remove leading/trailing hyphen
|
||||||
slug.downcase
|
.gsub(/^\-|\-$/i, '') \
|
||||||
|
# Downcase it
|
||||||
|
.downcase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue