diff options
Diffstat (limited to 'diff-lcs/tags/release-1.0.3/lib/diff/lcs/block.rb')
-rw-r--r-- | diff-lcs/tags/release-1.0.3/lib/diff/lcs/block.rb | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/diff-lcs/tags/release-1.0.3/lib/diff/lcs/block.rb b/diff-lcs/tags/release-1.0.3/lib/diff/lcs/block.rb deleted file mode 100644 index 7ffdbab..0000000 --- a/diff-lcs/tags/release-1.0.3/lib/diff/lcs/block.rb +++ /dev/null @@ -1,49 +0,0 @@ -#! /usr/env/bin ruby -#-- -# Copyright 2004 Austin Ziegler <diff-lcs@halostatue.ca> -# adapted from: -# Algorithm::Diff (Perl) by Ned Konz <perl@bike-nomad.com> -# Smalltalk by Mario I. Wolczko <mario@wolczko.com> -# 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$ -#++ - # A block is an operation removing, adding, or changing a group of items. - # Basically, this is just a list of changes, where each change adds or - # deletes a single item. Used by bin/diff. -class Diff::LCS::Block - attr_reader :changes, :insert, :remove - - def initialize(chunk) - @changes = [] - @insert = [] - @remove = [] - - chunk.each do |item| - @changes << item - @remove << item if item.deleting? - @insert << item if item.adding? - end - end - - def diff_size - @insert.size - @remove.size - end - - def op - case [@remove.empty?, @insert.empty?] - when [false, false] - '!' - when [false, true] - '-' - when [true, false] - '+' - else - '^' - end - end -end |