DEV: Remove monkey patch that is no longer required (#16648)

This commit is contained in:
Alan Guo Xiang Tan 2022-05-06 10:33:42 +08:00 committed by GitHub
parent ad7c324eb4
commit 4e5f5b67b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 21 deletions

View File

@ -9,27 +9,6 @@ class Search
class TextHelper
extend ActionView::Helpers::TextHelper
private
# TODO: Remove when https://github.com/rails/rails/pull/39979 is merged
# For a 10_000 words string, speeds up excerpts by 85X.
def self.cut_excerpt_part(part_position, part, separator, options)
return "", "" unless part
radius = options.fetch(:radius, 100)
omission = options.fetch(:omission, "...")
if separator != ""
part = part.split(separator)
part.delete("")
end
affix = part.length > radius ? omission : ""
part = part.public_send(part_position == :first ? :last : :first, radius)
part = part.join(separator) if separator != ""
[affix, part]
end
end
attr_reader(