comparateur 2.0.1 → 2.0.2
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 +4 -4
- data/bin/comparateur +0 -0
- data/lib/comparateur.rb +15 -0
- data/lib/comparateur/version.rb +1 -1
- data/spec/comparateur_spec.rb +9 -0
- 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: 79f672da53dc4ccffd1773264edab49969a70683
|
4
|
+
data.tar.gz: 830c582d053e556b525812dc9d5874bc7a5f38c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 798202125b54a75ac5171d29560cf38833985b9222be585b98692eb7105876202dc6ab379c4b6465a8c59e8b177cb1a888644553f38af4c946f51c7aecc9fd97
|
7
|
+
data.tar.gz: e2adb5986eb0b0736f567b3a7cbc9651aaa1a9819de10b1ae1330a83356d603721f0abb80e361c5681c9e6833d25ea29b5ab0aedf5172a7d290ded31bc884064
|
data/bin/comparateur
CHANGED
File without changes
|
data/lib/comparateur.rb
CHANGED
@@ -34,6 +34,21 @@ module Comparateur
|
|
34
34
|
s2 = serialize_content(str2)
|
35
35
|
lcs(s1, s2)
|
36
36
|
end
|
37
|
+
|
38
|
+
def compare_multiple_urls arr
|
39
|
+
result = {}
|
40
|
+
|
41
|
+
until arr.length == 1
|
42
|
+
first = arr.shift
|
43
|
+
|
44
|
+
arr.each do |url|
|
45
|
+
score = compare_urls(first, url)
|
46
|
+
result[[first, url]] = score
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
result
|
51
|
+
end
|
37
52
|
|
38
53
|
def lcs arr1, arr2
|
39
54
|
lcs = Diff::LCS.LCS(arr1, arr2)
|
data/lib/comparateur/version.rb
CHANGED
data/spec/comparateur_spec.rb
CHANGED
@@ -72,6 +72,15 @@ describe Comparateur do
|
|
72
72
|
expect(included_class.new.compare_content(@str1, @str2)).to eq 0.8
|
73
73
|
end
|
74
74
|
end
|
75
|
+
|
76
|
+
describe "compare_multiple_urls" do
|
77
|
+
my_arr = %w(http://google.com https://duckduckgo.com http://bing.com http://ask.com)
|
78
|
+
|
79
|
+
it "should return Hash" do
|
80
|
+
expect(extended_class.compare_multiple_urls(my_arr).class).to eq Hash
|
81
|
+
expect(included_class.new.compare_multiple_urls(my_arr).class).to eq Hash
|
82
|
+
end
|
83
|
+
end
|
75
84
|
|
76
85
|
describe "lcs" do
|
77
86
|
arr1 = %w(html body h1 a)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comparateur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radu-Bogdan Croitoru
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|