Class: Mutant::Differ
- Inherits:
-
Object
- Object
- Mutant::Differ
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutant/differ.rb
Overview
Class to create diffs from source code
Instance Method Summary collapse
-
#colorized_diff ⇒ String
private
Return colorized source diff.
-
#diff ⇒ String
private
Return source diff.
Instance Method Details
#colorized_diff ⇒ String
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.
Return colorized source diff
29 30 31 32 33 |
# File 'lib/mutant/differ.rb', line 29 def colorized_diff diff.lines.map do |line| self.class.colorize_line(line) end.join end |
#diff ⇒ String
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.
Return source diff
12 13 14 15 16 17 18 19 20 |
# File 'lib/mutant/differ.rb', line 12 def diff output = '' @diffs.each do |piece| hunk = Diff::LCS::Hunk.new(@old, @new, piece, CONTEXT_LINES, length_difference) output << hunk.diff(FORMAT) output << "\n" end output end |