cevennes 0.13.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +43 -6
  4. data/lib/cevennes.rb +2 -2
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47a07afbca693213e60ab7a4b7547cbe96d7130c
4
- data.tar.gz: cdc88ef22c41b30b458c08701c5c4a8a2d5fbffb
3
+ metadata.gz: ea7e96b87743825f65f95ecda2fd3d9bae8d74a5
4
+ data.tar.gz: 2ebe50c32f0889d5dcc92ecdb029feb9e390cef1
5
5
  SHA512:
6
- metadata.gz: 368a3167ddfc08eacad5ca460f7712439afa2681c759bd76a1f4e295e20ae579b2f8ba58f2580403d792c6c8d003946ea54b46b1c8ddab0a0125609307804a70
7
- data.tar.gz: cb24233d1269a45673a312d865394a3003515fb669db7fec4b998caa64beab620c02b56dd7c87a9f3061ac328842083e4652de0be6cfdbb1fc939fcaaa7e1b10
6
+ metadata.gz: c52dc9eed861868b48bb28601e6c99f74b2770d95cc5263c33bc978978d9336be2418e336eed560d777016ec6a698c4887624e5c6513ad98b2843749de614a08
7
+ data.tar.gz: ef83bf46e2c16a34d7dcf34da8d4edcc335eb9568356bfac0d20fb624fc8115a74692cf62bff52d7443bb51b82850a8f095b1c606e4f5701f5daafddc41b906e
@@ -2,6 +2,11 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## cevennes 1.0.0 not yet released
6
+
7
+ - Align the "keys" entry on the =+-! entries
8
+
9
+
5
10
  ## cevennes 0.13.0 released 2018-09-07
6
11
 
7
12
  - Trim cells and keys
data/README.md CHANGED
@@ -6,16 +6,53 @@
6
6
 
7
7
  Diffs CSVs by lines, focusing on a single ID
8
8
 
9
+
9
10
  ## usage
10
11
 
11
- TODO
12
+ Given two CSV strings and an identifier name, cevennes may compute a diff:
13
+ ```ruby
14
+ require 'cevennes'
15
+
16
+ cvs0 = %{
17
+ id,name,age
18
+ 0,John,33
19
+ 1,Jean-Baptiste,43
20
+ 3,Luke,21
21
+ }.strip + "\n"
22
+ cvs1 = %{
23
+ id,name,age
24
+ 0,John,33
25
+ 1,Jean-Baptiste,44
26
+ 4,Matthew,20
27
+ }.strip + "\n"
28
+
29
+ d = Cevennes.diff('id', cvs0, cvs1)
12
30
  ```
13
- csv0 = %{
14
- }
15
- csv1 = %{
16
- }
17
- pp Cevennes.diff('ISIN', csv0, csv1)
31
+
32
+ `d` will yield:
33
+ ```ruby
34
+ [
35
+ [ 'keys', 1, [ 'id', 'name', 'age' ],
36
+ 1, [ 'id', 'name', 'age' ] ],
37
+ [ 'stats',
38
+ { '=' => 1, '!' => 1, '-' => 1, '+' => 1,
39
+ 'l0' => 3, 'l1' => 3 } ],
40
+ [ '=', 2, [ '0', 'John', '33'],
41
+ 2, nil ],
42
+ [ '!', 3, [ '1', 'Jean-Baptiste', '43' ],
43
+ 3, [ '1', 'Jean-Baptiste', '44' ] ],
44
+ [ '-', 4, [ '3', 'Luke', '21'],
45
+ -1, nil ],
46
+ [ '+', -1, nil,
47
+ 4, [ '4', 'Matthew', '20' ] ]
48
+ ]
18
49
  ```
50
+ It's a list where the first entry is a recap of the keys used in the old and the new CSV strings (the integer is the line number (starting at 1) where the keys where found.
51
+
52
+ The second entry is a summary of the changes, altered `!` line count, removed `-` line count, added `+` line count, old length `l0`, new length `l1`, and unchanged `=` line count.
53
+
54
+ The remaining entries are the (non-)changes themselves, from line 1 to the end.
55
+
19
56
 
20
57
  ## LICENSE
21
58
 
@@ -4,7 +4,7 @@ require 'csv'
4
4
 
5
5
  module Cevennes
6
6
 
7
- VERSION = '0.13.0'
7
+ VERSION = '1.0.0'
8
8
 
9
9
  class << self
10
10
 
@@ -39,7 +39,7 @@ module Cevennes
39
39
  s['l0'] = h0.length
40
40
  s['l1'] = h1.length
41
41
 
42
- [ [ 'keys', ks0, ks1 ], [ 'stats', s ] ] + d
42
+ [ [ 'keys', *ks0, *ks1 ], [ 'stats', s ] ] + d
43
43
  end
44
44
 
45
45
  protected
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.13.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux