string_diff 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/string_diff/version.rb +1 -1
- data/lib/string_diff.rb +3 -2
- data/string_diff.gemspec +0 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f70c7948e72d79c0b55964ae736f1fc809fea94
|
4
|
+
data.tar.gz: 386023934c17d1e9537ac938b0d194291fd38f01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9270d80153e93f2cba4654aa2363f0a572d8d616526b313b5d342cb91aa66a150180b806a217498c0836c40830e3dd001e7980b29a62dbea76a3d2a0d868a143
|
7
|
+
data.tar.gz: 1cf252fc68bbaa2aa3fc64cd00b5c22c019b25d5f5fd7a032c505d9198d19b2eb550899009a61916740df48068e68c11404a06fb4ab0b9b14334d955bc9cbfd2
|
data/lib/string_diff/version.rb
CHANGED
data/lib/string_diff.rb
CHANGED
@@ -17,6 +17,8 @@ module StringDiff
|
|
17
17
|
construct_string(compare(a1, a2))
|
18
18
|
end
|
19
19
|
|
20
|
+
private
|
21
|
+
|
20
22
|
def compare(array1, array2)
|
21
23
|
deletions = array1 - array2
|
22
24
|
insertions = array2 - array1
|
@@ -29,9 +31,9 @@ module StringDiff
|
|
29
31
|
def annotate_deletions(deletions, array1)
|
30
32
|
deletions.each do |v|
|
31
33
|
index = array1.find_index(v)
|
34
|
+
next if index.nil?
|
32
35
|
array1[index] = "<span class='deletion'>#{v}</span>"
|
33
36
|
end
|
34
|
-
#array1.join(" ")
|
35
37
|
end
|
36
38
|
|
37
39
|
def annotate_insertions(insertions, array1, array2)
|
@@ -75,7 +77,6 @@ module StringDiff
|
|
75
77
|
|
76
78
|
array1[missing_index[0]] = "<span class='deletion'>#{word}</span>"
|
77
79
|
end
|
78
|
-
#array1.join(" ")
|
79
80
|
end
|
80
81
|
|
81
82
|
def construct_string(array1)
|
data/string_diff.gemspec
CHANGED
@@ -14,14 +14,6 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/natanio/string_diff"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
# if spec.respond_to?(:metadata)
|
20
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
# else
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
# end
|
24
|
-
|
25
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
18
|
spec.bindir = "exe"
|
27
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string_diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- natanio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|