Module: Evilution::Reporter::HTML::DiffFormatter Private
- Defined in:
- lib/evilution/reporter/html/diff_formatter.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .call(diff) ⇒ Object private
- .format_line(line) ⇒ Object private
- .line_class(line) ⇒ Object private
Class Method Details
.call(diff) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/evilution/reporter/html/diff_formatter.rb', line 9 def call(diff) diff.split("\n").map { |line| format_line(line) }.join("\n") end |
.format_line(line) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 16 |
# File 'lib/evilution/reporter/html/diff_formatter.rb', line 13 def format_line(line) css_class = line_class(line) %(<span class="#{css_class}">#{Evilution::Reporter::HTML::Escape.call(line)}</span>) end |
.line_class(line) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 25 26 |
# File 'lib/evilution/reporter/html/diff_formatter.rb', line 18 def line_class(line) if line.start_with?("- ") "diff-removed" elsif line.start_with?("+ ") "diff-added" else "" end end |