Class: Evilution::Reporter::Suggestion::DiffLines Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/reporter/suggestion/diff_lines.rb

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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original:, mutated:) ⇒ DiffLines

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.

Returns a new instance of DiffLines.



23
24
25
26
27
# File 'lib/evilution/reporter/suggestion/diff_lines.rb', line 23

def initialize(original:, mutated:)
  @original = original
  @mutated = mutated
  freeze
end

Instance Attribute Details

#mutatedObject (readonly)

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.



21
22
23
# File 'lib/evilution/reporter/suggestion/diff_lines.rb', line 21

def mutated
  @mutated
end

#originalObject (readonly)

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.



21
22
23
# File 'lib/evilution/reporter/suggestion/diff_lines.rb', line 21

def original
  @original
end

Class Method Details

.from_diff(raw_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.



6
7
8
9
10
11
12
# File 'lib/evilution/reporter/suggestion/diff_lines.rb', line 6

def self.from_diff(raw_diff)
  lines = raw_diff.split("\n")
  new(
    original: clean(lines.find { |l| l.start_with?("- ") }, "- "),
    mutated: clean(lines.find { |l| l.start_with?("+ ") }, "+ ")
  )
end