Class: Evilution::Compare::DiffExtractor::Evilution Private
- Inherits:
-
Object
- Object
- Evilution::Compare::DiffExtractor::Evilution
- Defined in:
- lib/evilution/compare/diff_extractor/evilution.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Extracts plus: payload arrays from Evilution-format diffs. Evilution diffs use "- " / "+ " line prefixes (note the trailing space) and do not carry unified-diff headers or hunk markers.
Instance Method Summary collapse
- #call(diff) ⇒ Object private
Instance 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 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/evilution/compare/diff_extractor/evilution.rb', line 9 def call(diff) minus = [] plus = [] diff.to_s.each_line do |line| line = line.chomp if line.start_with?("- ") minus << line[2..] elsif line.start_with?("+ ") plus << line[2..] end end { minus: minus, plus: plus } end |