Reduce allocation from normalize_whitespace filter (#8400)
Merge pull request 8400
This commit is contained in:
parent
f0e342d390
commit
ecbfa58d65
|
|
@ -113,7 +113,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the formatted String
|
# Returns the formatted String
|
||||||
def normalize_whitespace(input)
|
def normalize_whitespace(input)
|
||||||
input.to_s.gsub(%r!\s+!, " ").strip
|
input.to_s.gsub(%r!\s+!, " ").tap(&:strip!)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Count the number of words in the input string.
|
# Count the number of words in the input string.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue