nebulous 0.1.0 → 0.1.2
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 +4 -4
- data/lib/nebulous/delimiter_detector.rb +9 -1
- data/lib/nebulous/input/parsing.rb +3 -2
- data/lib/nebulous/input/reader.rb +1 -1
- data/lib/nebulous/parser.rb +1 -1
- data/lib/nebulous/version.rb +1 -1
- data/spec/nebulous/parser_spec.rb +12 -0
- data/spec/support/assets/crlf-comma-delimited-emptyline.csv +22 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29c4fbaeb91217e7196b9966ed06a349400a3d57
|
4
|
+
data.tar.gz: d1105b5b854fc279c757426c894bae1fc914b329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84645b05c28bbab1f3e5626377b0502f1aaa495d944197a44e8e767ed0c600726354ea0931f39ab48a016bf3577d497d89305c8aa06e813b530614186958c6f3
|
7
|
+
data.tar.gz: 455a43562135c5608bf8d7ef2de39a57df35cc39de43d017fc8efc7415cc0b0d2542a85dff4d3603e0ddc27409de661b733abea31521a30c008cafed73344131
|
@@ -62,7 +62,15 @@ module Nebulous
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def readline
|
65
|
-
|
65
|
+
ln = ''
|
66
|
+
|
67
|
+
File.open(path, 'r') do |io|
|
68
|
+
while ln.chomp.empty?
|
69
|
+
ln += io.readline
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
ln.encode(encoding, invalid: :replace)
|
66
74
|
end
|
67
75
|
end
|
68
76
|
end
|
@@ -7,11 +7,12 @@ module Nebulous
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def raw_headers
|
10
|
-
|
10
|
+
ln = read_complete_line
|
11
|
+
Row.parse(ln, options)
|
11
12
|
end
|
12
13
|
|
13
14
|
def read_headers
|
14
|
-
@headers ||= Row.headers(
|
15
|
+
@headers ||= Row.headers(read_complete_line, options)
|
15
16
|
end
|
16
17
|
|
17
18
|
def chunk
|
data/lib/nebulous/parser.rb
CHANGED
data/lib/nebulous/version.rb
CHANGED
@@ -32,6 +32,18 @@ describe Nebulous::Parser do
|
|
32
32
|
["First name", "Last name", "From", "Access", "Qty"]
|
33
33
|
)
|
34
34
|
end
|
35
|
+
|
36
|
+
context 'around empty lines' do
|
37
|
+
let(:path) do
|
38
|
+
'./spec/support/assets/crlf-comma-delimited-emptyline.csv'
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'returns expected headers' do
|
42
|
+
expect(parser.headers).to eq(
|
43
|
+
["First name", "Last name", "From", "Access", "Qty"]
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
35
47
|
end
|
36
48
|
end
|
37
49
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
First name,Last name,From,Access,Qty
|
3
|
+
どーもありがとう,ミスター·ロボット,VIP,VIP,2
|
4
|
+
Meghan,Koch,VIP,VIP,5
|
5
|
+
Genoveva,Dare,Zach Graves,vip,5
|
6
|
+
Eulalia,Stiedemann,VIP,GA,2
|
7
|
+
Kaylie,Lakin,Vans,VIP,1
|
8
|
+
Grace,Nienow,Vans,VIP,5
|
9
|
+
Alberto,Upton,Vans,VIP,5
|
10
|
+
Saige,Larson,Fan Club,VIP,4
|
11
|
+
Virginie,Lindgren,Zach Graves,VIP,5 passes
|
12
|
+
Ahmad,Bins,Vans,VIP,4
|
13
|
+
Sydni,Turcotte,Vans,VIP,5
|
14
|
+
Aylin,McLaughlin,Fan Club,GA,1
|
15
|
+
Jimmy,Hoppe,Zach Graves,GA,5
|
16
|
+
Isabell,Hills,Vans,VIP,4
|
17
|
+
Chad,Anderson,Zach Graves,GA,4
|
18
|
+
Arnold,Yundt,VIP,VIP,5
|
19
|
+
Cary,Halvorson,Vans,GA,1
|
20
|
+
Jedidiah,Feest,Zach Graves,GA,0
|
21
|
+
Carol,Reilly,Zach Graves,VIP,2
|
22
|
+
Heidi,Wunsch,Zach Graves,VIP,2 passes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nebulous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Graves
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- spec/support/assets/clrf-batches.csv
|
129
129
|
- spec/support/assets/cr-comma-delimited.csv
|
130
130
|
- spec/support/assets/cr-lf-comma-delimited.csv
|
131
|
+
- spec/support/assets/crlf-comma-delimited-emptyline.csv
|
131
132
|
- spec/support/assets/crlf-comma-delimited.csv
|
132
133
|
- spec/support/assets/crlf-dolla-delimited.csv
|
133
134
|
- spec/support/assets/crlf-pipe-delimited.csv
|
@@ -167,6 +168,7 @@ test_files:
|
|
167
168
|
- spec/support/assets/clrf-batches.csv
|
168
169
|
- spec/support/assets/cr-comma-delimited.csv
|
169
170
|
- spec/support/assets/cr-lf-comma-delimited.csv
|
171
|
+
- spec/support/assets/crlf-comma-delimited-emptyline.csv
|
170
172
|
- spec/support/assets/crlf-comma-delimited.csv
|
171
173
|
- spec/support/assets/crlf-dolla-delimited.csv
|
172
174
|
- spec/support/assets/crlf-pipe-delimited.csv
|