Commit ec6ed9f3 authored by Gary Holtz's avatar Gary Holtz Committed by Douglas Barbosa Alexandre

Updating the string methods used

parent 0daeab64
...@@ -18,19 +18,15 @@ module Gitlab ...@@ -18,19 +18,15 @@ module Gitlab
private private
def raw_diff def raw_diff
"#{diff_header}\n#{from_content_as_diff}#{spacer}#{to_content_as_diff}" "#{diff_header}\n#{from_content_as_diff}\n#{to_content_as_diff}"
end end
def diff_header def diff_header
"@@ -#{from_line} +#{from_line}" "@@ -#{from_line} +#{from_line}"
end end
def spacer
"\n" unless from_content_as_diff[-1, 3] == "\n"
end
def from_content_as_diff def from_content_as_diff
from_content.lines.map { |line| line.prepend('-') }.join from_content.lines.map { |line| line.prepend('-') }.join.delete_suffix("\n")
end end
def to_content_as_diff def to_content_as_diff
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment