cevennes 0.9.0 → 0.10.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 +6 -0
- data/README.md +7 -0
- data/lib/cevennes.rb +20 -15
- 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: e8fcfbf02c5a728c9a6364a0fe67a61003fa18fa
|
4
|
+
data.tar.gz: 72361059d05b8c7cca589fa099d4e92a58ca704d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd04c1d5c12954d091a75b55ccb0078757a35bfc1d7d7dc6fcf2cf3d23ecb6929ec47d05adbfc13be1646a4ca6040a05135b9ce4664a5f5947b5413e01bf4fd0
|
7
|
+
data.tar.gz: ee72cda27967a186dfea52a61ef67256b69f3d56ec95c0c3d0e61bc1084a74a35a59e3025a8a5666e29e7ebfc649c8c6d48a16dda7a64bc4919fbeee255252ee
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/cevennes.rb
CHANGED
@@ -4,7 +4,7 @@ require 'csv'
|
|
4
4
|
|
5
5
|
module Cevennes
|
6
6
|
|
7
|
-
VERSION = '0.
|
7
|
+
VERSION = '0.10.0'
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
@@ -20,16 +20,20 @@ module Cevennes
|
|
20
20
|
h0
|
21
21
|
.collect { |k, v|
|
22
22
|
v1 = h1[k]
|
23
|
-
if v1 ==
|
24
|
-
[ '
|
23
|
+
if v1 == nil
|
24
|
+
[ '-', *v, -1, nil ]
|
25
|
+
elsif v1[1] == v[1]
|
26
|
+
[ '=', *v, v[0], nil ]
|
25
27
|
else
|
26
|
-
[
|
28
|
+
[ '!', *v, *v1 ]
|
27
29
|
end }
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
|
31
|
+
(h1.keys - h0.keys)
|
32
|
+
.collect { |k| h1[k] }
|
33
|
+
.reverse
|
34
|
+
.each { |lnum, line|
|
35
|
+
i = d.index { |a, _, _, l1, _| l1 > lnum } || d.length
|
36
|
+
d.insert(i, [ '+', -1, nil, lnum, line ]) }
|
33
37
|
|
34
38
|
s = d.inject({}) { |h, (a, _, _)| h[a] = (h[a] || 0) + 1; h }
|
35
39
|
s['l0'] = h0.length - 1
|
@@ -43,16 +47,17 @@ module Cevennes
|
|
43
47
|
def hash(id, csv)
|
44
48
|
|
45
49
|
csva = ::CSV.parse(reencode(csv))
|
46
|
-
.
|
47
|
-
.
|
50
|
+
.each_with_index.collect { |row, i| [ 1 + i, row ] }
|
51
|
+
.reject { |i, row| row.compact.empty? }
|
52
|
+
.drop_while { |i, row| ! row.include?(id) }
|
48
53
|
|
49
|
-
|
54
|
+
idi = csva[0][1].index(id)
|
50
55
|
|
51
56
|
csva[1..-1]
|
52
|
-
.inject({ keys: csva[0] }) { |h, row|
|
57
|
+
.inject({ keys: csva[0] }) { |h, (i, row)|
|
53
58
|
if row.compact.length > 1
|
54
|
-
k = row[
|
55
|
-
h[k] = row if k
|
59
|
+
k = row[idi]
|
60
|
+
h[k] = [ i, row ] if k
|
56
61
|
end
|
57
62
|
h }
|
58
63
|
end
|