talira

Diff::LCS

Ruby library for diffs using the longest common subsequence algorithm

open sourceMIT OR Artistic-1.0-Perl OR GPL-2.0-or-laterfree

Diff::LCS (the diff-lcs gem) computes the differences between two Ruby Enumerable sequences with the McIlroy-Hunt longest common subsequence algorithm, and includes utilities for a simple HTML diff and a standard diff-like command-line tool. It's adapted from Perl's Algorithm::Diff and maintained by Austin Ziegler. Version 2.0 removed deprecations and requires Ruby 3.2 or later.

Problems it solves

  • compute the difference between two arrays in Ruby
  • show a text diff from a Ruby script
  • generate an HTML diff in Ruby

Features

  • McIlroy-Hunt LCS diffs of any Enumerable
  • HTML diff output
  • a standard diff-like command-line tool