csv-diff 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/csv-diff/algorithm.rb +1 -1
- data/lib/csv-diff/source.rb +12 -1
- data/lib/csv-diff/xml_source.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87807b9af487947c60d18ac81d38b6782133dfdb
|
4
|
+
data.tar.gz: 3681d305dc566f49e7b5166fd22f5ea858f1260f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4b617cae1c1e2201633ba5bdb2752aa16af6e293ac32c75b812502c11e54f8d930b965d7e86a81fd5592b1a469db2498a71b635fd563d576039a4808b6dd776
|
7
|
+
data.tar.gz: a6561a7c91e8e4cb8ef8487032fd8bd46794bc79854dca274d7134e251741395f049c2e5c8ca603e257310a961788d6c1472fdc9bf82a171b099f869c59cefcf
|
data/lib/csv-diff/algorithm.rb
CHANGED
data/lib/csv-diff/source.rb
CHANGED
@@ -115,7 +115,7 @@ class CSVDiff
|
|
115
115
|
@trim_whitespace = options.fetch(:trim_whitespace, false)
|
116
116
|
@ignore_header = options[:ignore_header]
|
117
117
|
@include = options[:include]
|
118
|
-
@
|
118
|
+
@exclude = options[:exclude]
|
119
119
|
@path = options.fetch(:path, 'NA') unless @path
|
120
120
|
@warnings = []
|
121
121
|
end
|
@@ -214,6 +214,17 @@ class CSVDiff
|
|
214
214
|
@data.each{ |rec| csv << rec }
|
215
215
|
end
|
216
216
|
end
|
217
|
+
|
218
|
+
|
219
|
+
# Convert the data in this source to Array<Hash> using the field names
|
220
|
+
# as keys for the Hash in each row.
|
221
|
+
def to_hash
|
222
|
+
@data.map do |row|
|
223
|
+
hsh = {}
|
224
|
+
@field_names.each_with_index.map{ |fld, i| hsh[fld] = row[i] }
|
225
|
+
hsh
|
226
|
+
end
|
227
|
+
end
|
217
228
|
|
218
229
|
|
219
230
|
private
|
data/lib/csv-diff/xml_source.rb
CHANGED
@@ -11,8 +11,8 @@ class CSVDiff
|
|
11
11
|
attr_accessor :context
|
12
12
|
|
13
13
|
# Create a new XMLSource, identified by +path+. Normally this is a path
|
14
|
-
# to the XML document, but any value is fine, as it
|
15
|
-
#
|
14
|
+
# to the XML document, but any value is fine, as it is just a label to
|
15
|
+
# identify this data set.
|
16
16
|
#
|
17
17
|
# @param path [String] A label for this data set (often a path to the
|
18
18
|
# XML document used as the source).
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv-diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Gardiner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
This library performs diffs of CSV data, or any table-like source.
|