simple_csv_reader 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1257ac24bb535dd8a802d2fdb507b68adccc66bcb7c042e9b9d6e30252685883
4
- data.tar.gz: e4c36b6597ccd5293a0a244fe8c4f07f65ccce638de14355b649c9e2aeda5190
3
+ metadata.gz: 5f9db42a81223ede030684309a036e82938f8870d9be4a1fb1797ee5dcf04fd1
4
+ data.tar.gz: fd7a39b8eed7006fc6136d47953f7921bd037bf2d7e2c98ad1714964a3b1e7e4
5
5
  SHA512:
6
- metadata.gz: ac55d646bad8ddd96d697778bbb6da9273e2be5af2cf1d820f1ca0d31f0f4ff2287956500a106de453ac2e18d97732143fe757883af86518d8d16856c41437ea
7
- data.tar.gz: cfc44981d4bf0c91cdd9c0bbfed8e31d19c99793c11ab669f3315250abb8fcbdee57f12bc1f8a36428568fbb853a8737713e66951d0d7a2fc19da7f96e1c817c
6
+ metadata.gz: b21b87edc91175bd8083cdd0d159f474477b50101668b76c012f2de3059c3796db491bcd37113df02675f40f0e12326d5f82ed47fef5e1495df87e5c91180f2a
7
+ data.tar.gz: 3b1c17f10f7916ba33caf253cd4c393b2bf28ba0b0d44318e351ec4c5bded1cada38e6329fe66861c7e51a12e7071e76b834ae7935c03bf12feb08244333db76
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_csv_reader (0.4.0)
4
+ simple_csv_reader (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,17 +32,29 @@ module SimpleCsvReader
32
32
  @default_converters = converters
33
33
  end
34
34
 
35
+ def self.default_nil_value
36
+ instance_variable_defined?(:@default_nil_value) ? @default_nil_value : nil
37
+ end
38
+
39
+ def self.default_nil_value=(value)
40
+ @default_nil_value = value
41
+ end
42
+
35
43
  private
36
44
 
37
45
  def csv
38
46
  header_converter = -> { @headers.invert.fetch(_1, _1) }
39
- CSV.parse(content, headers: :first_row, header_converters: header_converter, converters: converters)
47
+ CSV.parse(content, headers: :first_row, header_converters: header_converter, converters: converters, nil_value: nil_value)
40
48
  end
41
49
 
42
50
  def converters
43
51
  @options.fetch(:converters) { self.class.default_converters }
44
52
  end
45
53
 
54
+ def nil_value
55
+ @options.fetch(:nil_value) { self.class.default_nil_value }
56
+ end
57
+
46
58
  def content
47
59
  NKF.nkf('-w', File.read(@path, universal_newline: true))
48
60
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleCsvReader
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_csv_reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-04 00:00:00.000000000 Z
11
+ date: 2022-12-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple CSV reader.
14
14
  email: