Fix RuboCop Lint/AmbiguousRange (#41884).

git-svn-id: https://svn.redmine.org/redmine/trunk@23842 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2025-06-18 02:46:27 +00:00
parent a4a32179f6
commit 068a2868ae

View File

@@ -76,13 +76,9 @@ module Redmine
def line_to_html_raw(line, offsets)
if offsets
s = +''
unless offsets.first == 0
s << CGI.escapeHTML(line[0..offsets.first-1])
end
s << CGI.escapeHTML(line[0..(offsets.first - 1)]) unless offsets.first == 0
s << '<span>' + CGI.escapeHTML(line[offsets.first..offsets.last]) + '</span>'
unless offsets.last == -1
s << CGI.escapeHTML(line[offsets.last+1..-1])
end
s << CGI.escapeHTML(line[(offsets.last + 1)..-1]) unless offsets.last == -1
s
else
CGI.escapeHTML(line)