rightcsv 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +10 -10
- data/lib/rightcsv.rb +5 -5
- data/rightcsv.gemspec +3 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4070765799c0e9ac42f5fbabbd4b50267e26714666e24d35a97244daad0f7e30
|
4
|
+
data.tar.gz: 7ae613f9a62ea72299d8eee9690ecbb46fd37fb135da5f7547f88041f41a912e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1074b486da35cb4197273e65d1722ff9070d53ca76d3084606d39aacce4f4db21e8792c0813c8d4fcd19ffc47d0f89139a26d30ae696ebd8cb4fd360c79bcc8
|
7
|
+
data.tar.gz: 1e246e7fffdd659050915bbfa5dd3e4f31faf2dbc697136e4cd74509500db8c249ee13b92ac72580a760f1b9e32f6138e86012616f0cda5d22ac8e2ca9acadf1
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# RightCSV
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
The CSV library that returns empty string instead of nil.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,14 +20,16 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
23
|
+
```ruby
|
24
|
+
require 'rightcsv'
|
28
25
|
|
29
|
-
|
26
|
+
CSV.parse('a,,"","1,2"') #=> [["a", nil, "", "1,2"]]
|
27
|
+
RightCSV.parse('a,,"","1,2"') #=> [["a", "", "", "1,2"]]
|
30
28
|
|
31
|
-
|
29
|
+
CSV.generate_line(['a', nil, '', '1,2']) #=> "a,,\"\",\"1,2\"\n"
|
30
|
+
RightCSV.generate_line(['a', nil, '', '1,2']) #=> "a,,,\"1,2\"\n"
|
31
|
+
```
|
32
32
|
|
33
33
|
## Contributing
|
34
34
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
35
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/tmtm/rightcsv>.
|
data/lib/rightcsv.rb
CHANGED
@@ -11,7 +11,11 @@
|
|
11
11
|
require 'csv'
|
12
12
|
|
13
13
|
class RightCSV < CSV
|
14
|
-
def
|
14
|
+
def initialize(data, **options)
|
15
|
+
super(data, options.merge(nil_value: ''))
|
16
|
+
end
|
17
|
+
|
18
|
+
def init_separators(*)
|
15
19
|
super
|
16
20
|
unless @force_quotes
|
17
21
|
quote_orig = @quote
|
@@ -20,10 +24,6 @@ class RightCSV < CSV
|
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
23
|
-
|
24
|
-
def shift
|
25
|
-
super&.map{ |s| s.nil? ? '' : s }
|
26
|
-
end
|
27
27
|
end
|
28
28
|
|
29
29
|
class Array
|
data/rightcsv.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rightcsv"
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.2.0'
|
8
8
|
spec.licenses = ['MIT']
|
9
9
|
spec.authors = ["TOMITA Masahiro"]
|
10
10
|
spec.email = ["tommy@tmtm.org"]
|
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
+
spec.add_dependency 'csv', '~> 1.0.2'
|
24
|
+
|
23
25
|
spec.add_development_dependency "bundler", "~> 1.15"
|
24
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rightcsv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TOMITA Masahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-04 00:00:00.000000000 Z
|
12
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: 1.0.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.2
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
102
|
version: '0'
|
89
103
|
requirements: []
|
90
104
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.7.4
|
92
106
|
signing_key:
|
93
107
|
specification_version: 4
|
94
108
|
summary: right CSV library
|