cevennes 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/cevennes.rb +7 -6
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d93b3bdf44f0c33cf0e90d02a2f6021c06abb58
4
- data.tar.gz: c038beab1cc0a2e93079bfd27e861c78b5d50d21
3
+ metadata.gz: e2610da4dd8944295878072ffaef9e6c2633bd09
4
+ data.tar.gz: ecd79885f7e7e0b811c1b6bb6a909802389e8e8e
5
5
  SHA512:
6
- metadata.gz: d82a5c40592be7eb8ef83df1fda403dae71fc172bd815882c1c68f8feed32e842eedb7026433e68068d2d216aa3f0a246dec790a90ebce447658cdaa9d69bb2e
7
- data.tar.gz: 6b6e4edb32644166b67cef3d4d2bea2bfb57dda859b37013b132482c37f49f569047e8fcd87507cbe0a03ecd968cc88dceedfb81fb21d5d0996d7eb9787a6a0e
6
+ metadata.gz: 1fb2549ac3c6f76724ba434de5f9eac493f877ce016d19ea2c57f44ef1921366b2e5dc20996138e109a8475c7a8115d3b185fa65298c7f5deb0efca4b5096547
7
+ data.tar.gz: d8fbf42fb5f78eb3f5f4d47fbb3de3f1eff5186ccd762585fb9013a9649b587cda46268ce70bb628ff3f56376735d85c3bf57b817261a0bb06fe9cd894f60cbc
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## cevennes 0.11.0 released 2018-09-06
6
+
7
+ - Fail with IndexError on missing id in CSV old or new
8
+
9
+
5
10
  ## cevennes 0.11.0 released 2018-09-06
6
11
 
7
12
  - Fix l0 and l1 stats
data/lib/cevennes.rb CHANGED
@@ -4,14 +4,14 @@ require 'csv'
4
4
 
5
5
  module Cevennes
6
6
 
7
- VERSION = '0.11.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]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cevennes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux