difflcs 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,8 @@
1
1
  *0.6.0* (28 December 2008)
2
2
 
3
3
  * First release as a gem
4
+
5
+
6
+ *0.6.1* (31 December 2008)
7
+
8
+ * Updated README.txt
data/README.txt CHANGED
@@ -1,10 +1,54 @@
1
1
  = Diff Longest Common Sub String -- The diff sniffing out every move
2
2
 
3
+ A resonably fast diff algoritm using longest common substrings that
4
+ can also find text that has moved.
5
+
3
6
  PositionRange is a library by the LogiLogi Foundation, extracted from
4
7
  http://www.logilogi.org (http://foundation.logilogi.org).
5
8
 
6
9
  == Usage
7
10
 
11
+ First require it.
12
+
13
+ $ irb
14
+
15
+ > require 'rubygems'
16
+ > require 'difflcs'
17
+
18
+ Then it can be used on any set of arrays, in this example 123456789
19
+ and 120678934, of which the first '12' overlaps, '0' is new, '34' has
20
+ moved to the end, and '6789' overlaps too, but moved 2 positions to
21
+ the left.
22
+
23
+ NOTE: They are arrays, not strings.
24
+
25
+ > DiffLCS.diff('123456789'.split(''), '120678934'.split(''))
26
+ => {
27
+ :matched_old=>[0...2, 5...9, 2...4],
28
+ :matched_new=>[0...2, 3...7, 7...9]
29
+ },
30
+
31
+ As you see it can sniff out text that has moved too.
32
+
33
+ A minimum overlap size can be provided for speed purposes, and to
34
+ prevent too many matches;
35
+
36
+ > DiffLCS.diff('123456789'.split(''), '120678934'.split(''), :minimum_lcs_size => 3)
37
+ => {
38
+ :matched_old => PositionRange::List.from_s('5,9'),
39
+ :matched_new => PositionRange::List.from_s('3,7')
40
+ },
41
+
42
+
43
+ Diff can be called directly on strings too, if 'diff_l_c_s/string' is required.
44
+
45
+ > require 'diff_l_c_s/string'
46
+ > '123'.diff('321')
47
+ => {
48
+ :matched_old=>[2...3, 1...2, 0...1],
49
+ :matched_new=>[0...1, 1...2, 2...3]
50
+ }
51
+
8
52
  == Download
9
53
 
10
54
  The latest version of Diff LCS can be found at:
data/lib/diff_l_c_s.rb CHANGED
@@ -12,7 +12,7 @@
12
12
  #++#
13
13
 
14
14
  $:.unshift(File.dirname(__FILE__)) unless
15
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
15
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
16
16
 
17
17
  unless defined?(PositionRange)
18
18
  begin
@@ -2,7 +2,7 @@ module DiffLCS
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 6
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: difflcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wybo Wiersma
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-30 00:00:00 +01:00
12
+ date: 2008-12-31 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -36,17 +36,17 @@ files:
36
36
  - README.txt
37
37
  - CHANGELOG.txt
38
38
  - LICENSE.txt
39
+ - lib/diff_l_c_s.rb
39
40
  - lib/diff_l_c_s
41
+ - lib/diff_l_c_s/version.rb
42
+ - lib/diff_l_c_s/string.rb
40
43
  - lib/diff_l_c_s/counter.rb
41
44
  - lib/diff_l_c_s/word_split_array.rb
42
- - lib/diff_l_c_s/string.rb
43
- - lib/diff_l_c_s/version.rb
44
45
  - lib/difflcs.rb
45
- - lib/diff_l_c_s.rb
46
46
  - test/counter_test.rb
47
+ - test/word_split_array_test.rb
47
48
  - test/diff_l_c_s_test.rb
48
49
  - test/test_helper.rb
49
- - test/word_split_array_test.rb
50
50
  has_rdoc: true
51
51
  homepage: http://difflcs.rubyforge.org
52
52
  post_install_message: