smarter_csv 1.10.1 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTORS.md +2 -1
- data/README.md +4 -10
- data/lib/smarter_csv/header_validations.rb +1 -1
- data/lib/smarter_csv/options_processing.rb +4 -3
- data/lib/smarter_csv/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbc3d3e97a602c4b67a88a94eea6bb66feed23c061da6a1c07b04f84b820e8b0
|
4
|
+
data.tar.gz: be5eea03fa0baeec95557772aef9d2bfd6c3e200103e9b686078c05c392a0a74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb204a933e3f8ae93b626cd6c4c45e6296ece98f136b96389ae3d3459bb8826de3d128481faedb3e10fa85a547483568cce7fbb54de38ba6c8074b0276775123
|
7
|
+
data.tar.gz: 724279536101f6561299ffc619c12393395c019ed771cc1e7b37b376804a05bee22b179fbd30770f29f6a9c099864268ecb222a2af7497a254b43982942aec90
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
|
2
2
|
# SmarterCSV 1.x Change Log
|
3
3
|
|
4
|
+
## 1.10.3 (2024-03-10)
|
5
|
+
* fixed issue when frozen options are handed in (thanks to Daniel Pepper)
|
6
|
+
* cleaned-up rspec tests (thanks to Daniel Pepper)
|
7
|
+
* fixed link in README (issue #251)
|
8
|
+
|
9
|
+
## 1.10.2 (2024-02-11)
|
10
|
+
* improve error message for missing keys
|
11
|
+
|
4
12
|
## 1.10.1 (2024-01-07)
|
5
13
|
* fix incorrect warning about UTF-8 (issue #268, thanks hirowatari)
|
6
14
|
|
data/CONTRIBUTORS.md
CHANGED
@@ -51,4 +51,5 @@ A Big Thank you to everyone who filed issues, sent comments, and who contributed
|
|
51
51
|
* [Rahul Chaudhary](https://github.com/rahulch95)
|
52
52
|
* [Alessandro Fazzi](https://github.com/pioneerskies)
|
53
53
|
* [JP Camara](https://github.com/jpcamara)
|
54
|
-
* [
|
54
|
+
* [Kenton Hirowatari](https://github.com/hirowatari)
|
55
|
+
* [Daniel Pepper](https://github.com/dpep)
|
data/README.md
CHANGED
@@ -23,13 +23,8 @@
|
|
23
23
|
|
24
24
|
* default branch is `main` for 1.x development
|
25
25
|
|
26
|
-
* 2.x development is
|
27
|
-
-
|
28
|
-
|
29
|
-
#### Work towards Future Version 2.x
|
30
|
-
|
31
|
-
* Work towards SmarterCSV 2.x is still ongoing, with improved features, and more streamlined options, but consider it as experimental at this time.
|
32
|
-
Please check the [2.0-develop branch](https://github.com/tilo/smarter_csv/tree/2.0-develop), open any issues and pull requests with mention of tag v2.0.
|
26
|
+
* 2.x development is [MOVED TO THIS PR](https://github.com/tilo/smarter_csv/pull/267)
|
27
|
+
- 2.x behavior is still EXPERIMENTAL - DO NOT USE in production
|
33
28
|
|
34
29
|
---------------
|
35
30
|
|
@@ -394,10 +389,9 @@ And header and data validations will also be supported in 2.x
|
|
394
389
|
* some CSV files use un-escaped quotation characters inside fields. This can cause the import to break. To get around this, use the `:force_simple_split => true` option in combination with `:strip_chars_from_headers => /[\-"]/` . This will also significantly speed up the import.
|
395
390
|
If you would force a different :quote_char instead (setting it to a non-used character), then the import would be up to 5-times slower than using `:force_simple_split`.
|
396
391
|
|
397
|
-
##
|
398
|
-
|
399
|
-
http://www.unixgods.org/~tilo/Ruby/process_csv_as_hashes.html
|
392
|
+
## The original post that started SmarterCSV:
|
400
393
|
|
394
|
+
http://www.unixgods.org/Ruby/process_csv_as_hashes.html
|
401
395
|
|
402
396
|
|
403
397
|
## Installation
|
@@ -26,7 +26,7 @@ module SmarterCSV
|
|
26
26
|
missing_keys = options[:required_keys].select { |k| !headers_set.include?(k) }
|
27
27
|
|
28
28
|
unless missing_keys.empty?
|
29
|
-
raise SmarterCSV::MissingKeys, "ERROR: missing attributes: #{missing_keys.join(',')}"
|
29
|
+
raise SmarterCSV::MissingKeys, "ERROR: missing attributes: #{missing_keys.join(',')}. Check `SmarterCSV.headers` for original headers."
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -42,11 +42,12 @@ module SmarterCSV
|
|
42
42
|
def process_options(given_options = {})
|
43
43
|
puts "User provided options:\n#{pp(given_options)}\n" if given_options[:verbose]
|
44
44
|
|
45
|
+
@options = DEFAULT_OPTIONS.dup.merge!(given_options)
|
46
|
+
|
45
47
|
# fix invalid input
|
46
|
-
|
48
|
+
@options[:invalid_byte_sequence] ||= ''
|
47
49
|
|
48
|
-
@options
|
49
|
-
puts "Computed options:\n#{pp(@options)}\n" if given_options[:verbose]
|
50
|
+
puts "Computed options:\n#{pp(@options)}\n" if @options[:verbose]
|
50
51
|
|
51
52
|
validate_options!(@options)
|
52
53
|
@options
|
data/lib/smarter_csv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smarter_csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilo Sloboda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -104,6 +104,7 @@ extensions:
|
|
104
104
|
- ext/smarter_csv/extconf.rb
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
|
+
- ".rspec"
|
107
108
|
- ".rubocop.yml"
|
108
109
|
- ".rvmrc"
|
109
110
|
- CHANGELOG.md
|