[ANN] Diff::LCS 1.0.1

A

Austin Ziegler

Gavin Sinclair pointed out a couple of problems. These have been
fixed; the gem has been rebuilt and the latest CVS version of RubyGems
will properly install Diff::LCS and its executable files now. Also,
the binary is now called "ldiff", not just "diff", so as to not
conflict with the Unix diff program. If you have installed the
previous version, please remember to remove it before installing this
version. My apologies for the mixups.

===

Revision history for Ruby library Diff::LCS. Unless explicitly noted otherwise,
all changes are produced by Austin Ziegler <[email protected]>.

== Diff::LCS 1.0.1
* Minor modifications to the gemspec, the README.
* Renamed the diff program to ldiff (as well as the companion batch file) so as
to not collide with the standard diff program.
* Fixed issues with RubyGEMs. Requires RubyGems > 0.6.1 or >= 0.6.1 with the
latest CVS version.

== Diff::LCS 1.0
* Initial release based mostly on Perl's Algorithm::Diff.

Diff::LCS README
================
This is the 1.0.1 release of Diff::LCS for Ruby, based originally on Perl's
Algorithm::Diff[1]. It uses the McIlroy-Hunt longest common subsequence (LCS)
algorithm to compute intelligent differences between two sequenced enumerable
containers[2]. The implementation is based on Mario I. Wolczko's[3] Smalltalk
version (1.2, 1993)[4] and Ned Konz's[5] Perl version (Algorithm::Diff)[6].

Using this module is quite simple. By default, Diff::LCS does not extend
objects with the Diff::LCS interface, but will be called as if it were a
function:

require 'diff/lcs'

seq1 = %w(a b c e h j l m n p)
seq2 = %w(b c d e f j k l m r s t)

lcs = Diff::LCS.LCS(seq1, seq2)
diffs = Diff::LCS.diff(seq1, seq2)
sdiff = Diff::LCS.sdiff(seq1, seq2)
seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj)
bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj)

Objects can be extended with Diff::LCS:

seq1.extend(Diff::LCS)
lcs = seq1.lcs(seq2)
diffs = seq1.diff(seq2)
sdiff = seq1.sdiff(seq2)
seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj)
bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj)

By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String
will be extended for use this way.

Copyright
=========
#--
# Copyright 2004 Austin Ziegler <[email protected]>
# adapted from:
# Algorithm::Diff (Perl) by Ned Konz <[email protected]>
# Smalltalk by Mario I. Wolczko <[email protected]>
# implements McIlroy-Hunt diff algorithm
#
# This program is free software. It may be redistributed and/or modified under
# the terms of the GPL version 2 (or later), the Perl Artistic licence, or the
# Ruby licence.
#
# $Id: README,v 1.2 2004/07/05 05:44:53 austin Exp $
#++

Footnotes
=========
[1] This library is called Diff::LCS because there are multiple
Ruby libraries called Algorithm::Diff maintained by other authors.
[2] By sequenced enumerable, I mean that the order of enumeration is
predictable and consistent for the same set of data. While it is
theoretically possible to generate a diff for unordereded hash, it
will only be meaningful if the enumeration of the hashes is
consistent. In general, this will mean that containers that behave
like String or Array will perform best.
[3] (e-mail address removed)
[4] ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st
[5] (e-mail address removed)
[6] http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top