Reduce allocation from normalize_whitespace filter (#8400)

Merge pull request 8400
This commit is contained in:
Ashwin Maroli 2020-10-01 19:23:12 +05:30 committed by GitHub
parent f0e342d390
commit ecbfa58d65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ module Jekyll
#
# Returns the formatted String
def normalize_whitespace(input)
input.to_s.gsub(%r!\s+!, " ").strip
input.to_s.gsub(%r!\s+!, " ").tap(&:strip!)
end
# Count the number of words in the input string.