simple_csv_reader 0.4.0 → 0.6.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: a372426e0dc660c6d61cd5a441e5ba1a986397de17306f1dccfdfb5017a254d4
4
+ data.tar.gz: fe318098c6c59d3ba13ed0a3060bd6a3b4fb4bb3d22e842f2ad8c3ba10b10560
5
5
  SHA512:
6
- metadata.gz: ac55d646bad8ddd96d697778bbb6da9273e2be5af2cf1d820f1ca0d31f0f4ff2287956500a106de453ac2e18d97732143fe757883af86518d8d16856c41437ea
7
- data.tar.gz: cfc44981d4bf0c91cdd9c0bbfed8e31d19c99793c11ab669f3315250abb8fcbdee57f12bc1f8a36428568fbb853a8737713e66951d0d7a2fc19da7f96e1c817c
6
+ metadata.gz: 433b1f429e3fa498d955dc017ee1095c71306e135b24ee29f597e0d95fd7f778c9fa7be8a6aaa758877fc8c4cd39fdea599068e54725ae5d3de5466a7cd74972
7
+ data.tar.gz: 6e0eb5a038672de1d16e94028a916c0a58df30fa20f24b61a5c86c0f1913902b7dddf8662650f6bf4c109e2191466260fb5478a104292a44a59295122b1a4515
@@ -11,7 +11,7 @@ jobs:
11
11
  strategy:
12
12
  fail-fast: false
13
13
  matrix:
14
- ruby: ["2.7", "3.0", "3.1"]
14
+ ruby: ["3.1", "3.2", "3.3"]
15
15
  steps:
16
16
  - uses: actions/checkout@v3
17
17
  - name: Set up Ruby
data/Gemfile.lock CHANGED
@@ -1,13 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_csv_reader (0.4.0)
4
+ simple_csv_reader (0.6.0)
5
+ csv
6
+ nkf
5
7
 
6
8
  GEM
7
9
  remote: https://rubygems.org/
8
10
  specs:
9
11
  ast (2.4.2)
12
+ csv (3.3.0)
10
13
  diff-lcs (1.5.0)
14
+ nkf (0.2.0)
11
15
  parallel (1.22.1)
12
16
  parser (3.1.2.0)
13
17
  ast (~> 2.4.1)
@@ -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.6.0'
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "A simple CSV reader."
13
13
  spec.homepage = "https://github.com/aki77/simple_csv_reader"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/aki77/simple_csv_reader"
@@ -28,7 +28,8 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  # Uncomment to register a new dependency of your gem
31
- # spec.add_dependency "example-gem", "~> 1.0"
31
+ spec.add_dependency 'csv'
32
+ spec.add_dependency 'nkf'
32
33
 
33
34
  # For more information and examples about making a new gem, checkout our
34
35
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,15 +1,43 @@
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.6.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
12
- dependencies: []
11
+ date: 2024-08-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: csv
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nkf
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  description: A simple CSV reader.
14
42
  email:
15
43
  - aki77@users.noreply.github.com
@@ -49,14 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
49
77
  requirements:
50
78
  - - ">="
51
79
  - !ruby/object:Gem::Version
52
- version: 2.7.0
80
+ version: 3.1.0
53
81
  required_rubygems_version: !ruby/object:Gem::Requirement
54
82
  requirements:
55
83
  - - ">="
56
84
  - !ruby/object:Gem::Version
57
85
  version: '0'
58
86
  requirements: []
59
- rubygems_version: 3.3.26
87
+ rubygems_version: 3.5.3
60
88
  signing_key:
61
89
  specification_version: 4
62
90
  summary: A simple CSV reader.