nesquikcsv 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -3
- data/lib/nesquikcsv/version.rb +1 -1
- data/lib/nesquikcsv.rb +1 -3
- data/nesquikcsv.gemspec +1 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d271c73f54f112004ff11719fbff3c690e18bc55
|
4
|
+
data.tar.gz: 5f87efeb1673e2ff5d99bc247d1fa92f630dbbf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cc8cb08eae5eed24b3c5114194b784ab81e966c153b640fa1c4d16a773cddbb9ed4e2be18487b97bb85da96c3c41305717b0ae5133c8dbdef4d9a9d373e85f7
|
7
|
+
data.tar.gz: b25355aac02167cb2a9eda62896579a3e209e7ec69eee6c1b9c8f4b0f24c90e175e87b04e6b685b742b46c74692c3e17e1b266e31d331e6643d0120237fd9512
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# NesquikCSV
|
2
2
|
|
3
|
-
Fork of the Fastest-CSV gem to support
|
3
|
+
Fork of the Fastest-CSV gem to support any encoding, using UTF-8 by default.
|
4
|
+
|
5
|
+
Uses native C code to parse CSV lines in MRI Ruby.
|
4
6
|
|
5
7
|
Supports standard CSV according to RFC4180. Not the so-called "csv" from Excel.
|
6
8
|
|
@@ -27,12 +29,18 @@ Parse single line
|
|
27
29
|
# If no encoding is specified UTF-8 is assumed
|
28
30
|
NesquikCSV.parse_line "one,two,three"
|
29
31
|
=> ["one", "two", "three"]
|
32
|
+
|
33
|
+
# You can also specify an encoding of choice
|
30
34
|
NesquikCSV.parse_line "uno,dós,trés", "ASCII-8BIT"
|
31
35
|
=> ["uno", "d\xC3\xB3s", "tr\xC3\xA9s"]
|
32
36
|
|
33
37
|
Parse string in array of arrays
|
34
38
|
|
35
|
-
#
|
39
|
+
# Read file contents into string
|
40
|
+
csv_data = "one,two,three"
|
41
|
+
# Defaults to UTF-8 encoding
|
36
42
|
rows = NesquikCSV.parse(csv_data)
|
37
|
-
|
43
|
+
=> ["one", "two", "three"]
|
44
|
+
# Or explicitly
|
38
45
|
rows = NesquikCSV.parse(csv_data, "UTF-8")
|
46
|
+
=> ["one", "two", "three"]
|
data/lib/nesquikcsv/version.rb
CHANGED
data/lib/nesquikcsv.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# This loads either csv_parser.so, csv_parser.bundle or
|
2
|
-
# csv_parser.jar, depending on your Ruby platform and OS
|
3
1
|
require 'csv_parser'
|
4
2
|
require 'stringio'
|
5
3
|
|
@@ -14,7 +12,7 @@ class NesquikCSV
|
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
17
|
-
# Opens a csv file. Pass a
|
15
|
+
# Opens a csv file. Pass a NesquikCSV instance to the provided block,
|
18
16
|
# or return it when no block is provided
|
19
17
|
def self.open(path, mode = "rb")
|
20
18
|
csv = new(File.open(path, mode))
|
data/nesquikcsv.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nesquikcsv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Martty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -17,7 +17,7 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
|
-
type: :
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|