string_diff 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 711634734d27fd21de01628616434c4ca01b404a
4
- data.tar.gz: be5d5d2d48887e22e8c638b98ab583e7cea17cc7
3
+ metadata.gz: 3f70c7948e72d79c0b55964ae736f1fc809fea94
4
+ data.tar.gz: 386023934c17d1e9537ac938b0d194291fd38f01
5
5
  SHA512:
6
- metadata.gz: b3929b85ba0fd944eaeaa605315b2c3b8510e455ea0ba0d047899abb7c48ba9c699cd8abc35cb6e6c50d7bf7d8d0d267c5acb475db46517d3a02d3a24654b6f4
7
- data.tar.gz: 76474e574c92897507a0d4992979d113eed485eef00c0999c9559a3deb188534238342d55d26fab532c06ba7863eaa3b0f55db300287351d7e19f4da399e2f3b
6
+ metadata.gz: 9270d80153e93f2cba4654aa2363f0a572d8d616526b313b5d342cb91aa66a150180b806a217498c0836c40830e3dd001e7980b29a62dbea76a3d2a0d868a143
7
+ data.tar.gz: 1cf252fc68bbaa2aa3fc64cd00b5c22c019b25d5f5fd7a032c505d9198d19b2eb550899009a61916740df48068e68c11404a06fb4ab0b9b14334d955bc9cbfd2
@@ -1,3 +1,3 @@
1
1
  module StringDiff
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-13 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler