cevennes 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/cevennes.rb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2610da4dd8944295878072ffaef9e6c2633bd09
|
4
|
+
data.tar.gz: ecd79885f7e7e0b811c1b6bb6a909802389e8e8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fb2549ac3c6f76724ba434de5f9eac493f877ce016d19ea2c57f44ef1921366b2e5dc20996138e109a8475c7a8115d3b185fa65298c7f5deb0efca4b5096547
|
7
|
+
data.tar.gz: d8fbf42fb5f78eb3f5f4d47fbb3de3f1eff5186ccd762585fb9013a9649b587cda46268ce70bb628ff3f56376735d85c3bf57b817261a0bb06fe9cd894f60cbc
|
data/CHANGELOG.md
CHANGED
data/lib/cevennes.rb
CHANGED
@@ -4,14 +4,14 @@ require 'csv'
|
|
4
4
|
|
5
5
|
module Cevennes
|
6
6
|
|
7
|
-
VERSION = '0.
|
7
|
+
VERSION = '0.12.0'
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
11
11
|
def diff(id, csv0, csv1)
|
12
12
|
|
13
|
-
h0 = hash(id, csv0)
|
14
|
-
h1 = hash(id, csv1)
|
13
|
+
h0 = hash('old', id, csv0)
|
14
|
+
h1 = hash('new', id, csv1)
|
15
15
|
|
16
16
|
ks0 = h0.delete(:keys)
|
17
17
|
ks1 = h1.delete(:keys)
|
@@ -38,21 +38,22 @@ module Cevennes
|
|
38
38
|
s = d.inject({}) { |h, (a, _, _)| h[a] = (h[a] || 0) + 1; h }
|
39
39
|
s['l0'] = h0.length
|
40
40
|
s['l1'] = h1.length
|
41
|
-
#s['ll0'] = s['='] + s['!'] + s['-']
|
42
|
-
#s['ll1'] = s['='] + s['!'] + s['+']
|
43
41
|
|
44
42
|
[ [ 'keys', ks0, ks1 ], [ 'stats', s ] ] + d
|
45
43
|
end
|
46
44
|
|
47
45
|
protected
|
48
46
|
|
49
|
-
def hash(id, csv)
|
47
|
+
def hash(version, id, csv)
|
50
48
|
|
51
49
|
csva = ::CSV.parse(reencode(csv))
|
52
50
|
.each_with_index.collect { |row, i| [ 1 + i, row ] }
|
53
51
|
.reject { |i, row| row.compact.empty? }
|
54
52
|
.drop_while { |i, row| ! row.include?(id) }
|
55
53
|
|
54
|
+
fail ::IndexError.new("id #{id.inspect} not found in #{version} CSV") \
|
55
|
+
if csva.empty?
|
56
|
+
|
56
57
|
idi = csva[0][1].index(id)
|
57
58
|
|
58
59
|
csva[1..-1]
|