问题描述
寻找一个Ruby差异引擎。所以你可以做一些与meld viewer相同的东西。
例如,你每行都有第一组代码:- 字符串1
- 字符串2
- 字符串3
第二套:
- String1
- String3 li>
- String4
差异显示第2行和第3行不同。
我已经在使用这个:,但它绝对不是完美的,但相当不错。我想补充一点,但是我试图在继续讨论这个问题之前找到另一个知识。 解决方案
寻找一个Ruby差异引擎。所以你可以做一些与meld viewer相同的东西。
例如,你每行都有第一组代码:
第二套:
差异显示第2行和第3行不同。
我已经在使用这个:,但它绝对不是完美的,但相当不错。我想补充一点,但是我试图在继续讨论这个问题之前找到另一个知识。 解决方案
标准解决方案是Austin Ziegler的 diff-lcs
库,其中 顾名思义就是 –实现最长的公共子序列算法。更准确地说,McIlroy和Hunt的LCS算法。这个库是Mario I. Wolczko的Smalltalk的一个实现,该实现从1993年开始用于McIlroy-Hunt算法以及 Algorithm :: Diff
Perl库。
不幸的是,自2004年以来还没有一个版本。这不会太坏,因为自1976年以来McIlroy-Hunt算法没有改变,但是 String
Ruby中的处理在Ruby 1.9中发生了显着变化。
Looking for a Ruby differencing engine. So you can do some of the same things meld viewer does.
For example you have this first set of code per line:
2nd set:
The diff would come out to show lines 2 and 3 are different.
I already am using this one: http://github.com/pvande/differ, but it's definitely not perfect but pretty good. I would like to add on to it, however I'm trying to find some knowledge on another one before going further with this differ.
The "standard" solution is Austin Ziegler's diff-lcs
library, which – as the name implies – implements a longest common subsequence algorithm. More precisely, the LCS algorithm by McIlroy and Hunt. This library is a port of Mario I. Wolczko's Smalltalk implementation of the McIlroy-Hunt algorithm from 1993 as well es the Algorithm::Diff
Perl library.
Unfortunately, there hasn't been a release since 2004. Which wouldn't be that bad, since the McIlroy-Hunt algorithm hasn't changed since 1976, but String
handling in Ruby has changed significantly in Ruby 1.9.
这篇关于红宝石差分引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!