class

Similar::TextDiffConfig

Inherits Reference < Object

Configuration for text diffs.

Instance methods

algorithm(alg : Algorithm) : self

Changes the algorithm.

The default algorithm is Algorithm::Myers.

Source
diff_chars(old : String, new : String) : TextDiff(String)

Creates a diff of characters.

Source
diff_chars(old : Bytes, new : Bytes) : TextDiff(BytesWrapper)

Creates a diff of bytes.

Source
diff_graphemes(old : String, new : String) : TextDiff(String)

Creates a diff of graphemes.

This splits the text into grapheme clusters.

Source
diff_lines(old : String, new : String) : TextDiff(String)

Creates a diff of lines.

This splits the text old and new into lines preserving newlines in the input.

Source
diff_lines(old : Bytes, new : Bytes) : TextDiff(BytesWrapper)

Creates a diff of lines for bytes.

Source
diff_slices(old : Array(T), new : Array(T)) : TextDiff(T) forall T

Creates a diff of arbitrary slices.

Source
diff_unicode_words(old : String, new : String) : TextDiff(String)

Creates a diff of unicode words.

This splits the text into words according to unicode rules.

Source
diff_words(old : String, new : String) : TextDiff(String)

Creates a diff of words.

This splits the text into words and whitespace.

Source
diff_words(old : Bytes, new : Bytes) : TextDiff(BytesWrapper)

Creates a diff of words for bytes.

Source
newline_terminated(yes : Bool) : self

Changes the newline termination flag.

The default is automatic based on input. This flag controls the behavior of TextDiff#iter_changes and unified diff generation with regards to newlines. When the flag is set to false (which is the default) then newlines are added. Otherwise the newlines from the source sequences are reused.

Source