summaryrefslogtreecommitdiff
path: root/app/helpers/diff_helper.rb
diff options
context:
space:
mode:
authorgfyoung <gfyoung17@gmail.com>2018-08-18 04:19:57 -0700
committergfyoung <gfyoung17@gmail.com>2018-09-06 17:33:46 -0700
commit1993a4449a5be44acfa5a9e1a94842e05da5edd5 (patch)
tree80a38bd0b427a5baf7ca36a3a71f8eb75c9d912f /app/helpers/diff_helper.rb
parent07d5ee361a438fcfff28fe184bbec2aa98ce5d14 (diff)
downloadgitlab-ce-1993a4449a5be44acfa5a9e1a94842e05da5edd5.tar.gz
Enable frozen string for app/helpers/**/*.rb
Partially addresses #47424.
Diffstat (limited to 'app/helpers/diff_helper.rb')
-rw-r--r--app/helpers/diff_helper.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index 1bb82fd8150..7684734c014 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module DiffHelper
def mark_inline_diffs(old_line, new_line)
old_diffs, new_diffs = Gitlab::Diff::InlineDiff.new(old_line, new_line).inline_diffs
@@ -39,7 +41,8 @@ module DiffHelper
line_num_class = %w[diff-line-num unfold js-unfold]
line_num_class << 'js-unfold-bottom' if bottom
- html = ''
+ html = []
+
if old_pos
html << content_tag(:td, '...', class: [*line_num_class, 'old_line'], data: { linenumber: old_pos })
html << content_tag(:td, text, class: [*content_line_class, 'left-side']) if view == :parallel
@@ -50,7 +53,7 @@ module DiffHelper
html << content_tag(:td, text, class: [*content_line_class, ('right-side' if view == :parallel)])
end
- html.html_safe
+ html.join.html_safe
end
def diff_line_content(line)
@@ -215,9 +218,7 @@ module DiffHelper
end
def toggle_whitespace_link(url, options)
- options[:class] ||= ''
- options[:class] << ' btn btn-default'
-
+ options[:class] = [*options[:class], 'btn btn-default'].join(' ')
link_to "#{hide_whitespace? ? 'Show' : 'Hide'} whitespace changes", url, class: options[:class]
end