valigator-csv 1.1.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 325bd8b898cc324095f85b90956285b9fd49eb1c
4
- data.tar.gz: dc833a514d767425f97077301ccb0addb3841335
3
+ metadata.gz: ded0cc9a296b760d8b566f1f948672210a2ff9ac
4
+ data.tar.gz: 6df32436f942a618336e78f513f46f2c3e1eef64
5
5
  SHA512:
6
- metadata.gz: 5f30e36ff1d0158203df6907dd192915dc07e65ec193a267ac17176727a8dca6d1aaa6b8e0b5cc52f2d99e32d892a3969c1798454297789b03f6f0f9970d9e25
7
- data.tar.gz: 5ed312f29eba227c354f9bcd6e3897227330aca19f6fc4d3b9197f514143269aceaaa53dd0cef59fe9163a697dcc0babf3f0867335b54a0f19074d23bb2d2e37
6
+ metadata.gz: 5f53067e4a2bb4abc6f440070a4ecd823d4c1c02af520d531406e59eba16e0e7b62a479957fce985aee516dc564a8fefae6c8ddab1bf3fa3bd82969e9de7c18c
7
+ data.tar.gz: 8db08753f5518c6268275ed8feb786ef30a93df624e9529e504c7d9e4d76bcbd11d501f95803c908f982ec45c49f9c1985d24f1be71d82d093800760d0b94a21
@@ -15,11 +15,23 @@ module Valigator
15
15
 
16
16
 
17
17
  def validate(options = {})
18
- ::CSV.foreach(@filename, "r:#{options[:encoding] || 'UTF-8'}") { |_row| }
18
+ ::CSV.foreach(@filename, build_options(options)) { |_row|}
19
19
  rescue ::CSV::MalformedCSVError, ArgumentError => error
20
20
  @errors << CSV::Error.new(error)
21
21
  end
22
22
 
23
+
24
+
25
+ private
26
+
27
+ def build_options(options = {})
28
+ {
29
+ col_sep: options[:col_sep] || ',',
30
+ quote_char: options[:quote_char] || '"',
31
+ encoding: options[:encoding] || 'UTF-8'
32
+ }
33
+ end
34
+
23
35
  end
24
36
  end
25
37
  end
@@ -1,5 +1,5 @@
1
1
  module Valigator
2
2
  module CSV
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valigator-csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Nagy