| Class | Diff::Hunk |
| In: |
lib/taskjuggler/AlgorithmDiff.rb
|
| Parent: | Object |
A Hunk stores all information about a contiguous change of the destination list. It stores the inserted and deleted values as well as their positions in the A and B list.
| aIdx | [RW] | |
| bIdx | [RW] | |
| deleteValues | [R] | |
| insertValues | [R] |
Create a new Hunk. aIdx is the index in the A list. bIdx is the index in the B list.
# File lib/taskjuggler/AlgorithmDiff.rb, line 32 def initialize(aIdx, bIdx) @aIdx = aIdx # A list of values to be deleted from the A list starting at aIdx. @deleteValues = [] @bIdx = bIdx # A list of values to be inserted into the B list at bIdx. @insertValues = [] end
# File lib/taskjuggler/AlgorithmDiff.rb, line 52 def to_s str = '' showSeparator = false if insert? && delete? str << "#{aRange}c#{bRange}\n" showSeparator = true elsif insert? str << "#{aIdx}a#{bRange}\n" else str << "#{aRange}d#{bIdx}\n" end @deleteValues.each { |value| str << "< #{value}\n" } str << "---\n" if showSeparator @insertValues.each { |value| str << "> #{value}\n" } str end