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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74bfc3df2e2ed6df39c92bce5fdd293fa6a002fa
4
- data.tar.gz: 7c2ecfaacee39d2e86d6dde7d7ecae9b11c6f8b5
3
+ metadata.gz: 79f672da53dc4ccffd1773264edab49969a70683
4
+ data.tar.gz: 830c582d053e556b525812dc9d5874bc7a5f38c4
5
5
  SHA512:
6
- metadata.gz: ebc98d46932ccb8789c4e18b5d1ae18fb6e2cfa4bb163e05cd26a2fc308f4c6d1dd2b92e92cf1702ab3f92c5a2597b44288678e57fe54c78a39218272410d442
7
- data.tar.gz: 2b781f602c35dd84be3cc313c1ab5156ab005b5313bc16f2ae0fc04a94f6f81dc5e8a9cd2aed30879ef93147edd42b11a4ce98eb7b64ef08f6111edac6e1758a
6
+ metadata.gz: 798202125b54a75ac5171d29560cf38833985b9222be585b98692eb7105876202dc6ab379c4b6465a8c59e8b177cb1a888644553f38af4c946f51c7aecc9fd97
7
+ data.tar.gz: e2adb5986eb0b0736f567b3a7cbc9651aaa1a9819de10b1ae1330a83356d603721f0abb80e361c5681c9e6833d25ea29b5ab0aedf5172a7d290ded31bc884064
File without changes
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Comparateur
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
@@ -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.1
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-07 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri