Captures diff op codes for textual diffs.
Constructors
new(old_tokens :
Array(
T), new_tokens :
Array(
T), algorithm :
Algorithm =
Algorithm::Myers, newline_terminated :
Bool = false)
Creates a new text diff from already tokenized slices.
SourceClass methods
configure
Configures a text differ before diffing.
Sourcefrom_chars(old :
Bytes, new :
Bytes) :
TextDiff(
BytesWrapper)
SourceCreates a diff of graphemes.
Sourcefrom_lines(old :
Bytes, new :
Bytes) :
TextDiff(
BytesWrapper)
Creates a diff of lines for bytes.
Sourcefrom_slices(old :
Array(
U), new :
Array(
U)) :
TextDiff(
U) forall
U Creates a diff of arbitrary slices.
SourceCreates a diff of unicode words.
Sourcefrom_words(old :
Bytes, new :
Bytes) :
TextDiff(
BytesWrapper)
Creates a diff of words for bytes.
SourceInstance methods
algorithm
The name of the algorithm that created the diff.
SourceIsolate change clusters by eliminating ranges with no changes.
Sourceiter_all_changes
Flattens out the diff into all changes.
Sourceiter_changes(op :
DiffOp) :
ChangesIter(
Array(
T),
Array(
T),
T)
Iterates over the changes the op expands to.
Sourceiter_inline_changes(op :
DiffOp) :
Array(
InlineChange)
Iterates over inline changes for a diff operation.
This is like iter_changes but with inline highlight info for
replace operations.
Sourcenewline_terminated
Returns true if items in the slice are newline terminated.
Sourceops
Returns the captured diff ops.
Sourceratio
Return a measure of the sequences' similarity in the range 0..=1.
Sourceunified_diff
Returns a unified diff formatter.
Source