table_importer 0.0.2 → 0.0.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d96649e2bb1fb93a77a49019b489b53a57d90cdc
|
4
|
+
data.tar.gz: f63a9fb9cd0436e91d2d87574a1d28d6839a8766
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afa372753ff8d5ec9f2f3f9cecfddb79c12a4515281bf1eed10d074ba1337e4c83d515670a5453efcc9b53e9c6bc14305ab3bff078a20eb6d35bbc8a46a2b0f4
|
7
|
+
data.tar.gz: d505d9da61e7e52e3b989f23d56d31e27e9c138063f1749be435a12a13216d88683b587f71ace951a21b2d72fb319979743897294bc9e882a290b530fdb9aa30
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module TableImporter
|
2
|
-
|
3
|
-
# require 'import_sources/excel_source'
|
4
|
-
# require 'import_sources/string_source'
|
2
|
+
|
5
3
|
class Source
|
6
4
|
|
7
5
|
SEPARATORS = {comma: ",", space: " ", tab: "\t", newline_mac: "\n", semicolon: ";", pipe: "|", newline_windows: "\r\n", old_newline_mac: "\r"}
|
@@ -139,8 +137,10 @@ module TableImporter
|
|
139
137
|
|
140
138
|
def remove_empty_columns(chunks, headers)
|
141
139
|
chunks.each do |chunk|
|
142
|
-
|
143
|
-
|
140
|
+
unless chunk[:lines].empty?
|
141
|
+
headers.each do |header|
|
142
|
+
chunk[:lines][0][header] = "empty_column"
|
143
|
+
end
|
144
144
|
end
|
145
145
|
end
|
146
146
|
chunks
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Dowse
|
@@ -159,9 +159,6 @@ files:
|
|
159
159
|
- lib/table_importer/exceptions.rb
|
160
160
|
- lib/table_importer/source.rb
|
161
161
|
- lib/table_importer/version.rb
|
162
|
-
- spec/copy_and_paste_spec.rb
|
163
|
-
- spec/csv_spec.rb
|
164
|
-
- spec/excel_spec.rb
|
165
162
|
- spec/files/csv/edge_cases.csv
|
166
163
|
- spec/files/csv/mexico2013_pressdoc.csv
|
167
164
|
- spec/files/csv/no_content.csv
|
@@ -171,6 +168,9 @@ files:
|
|
171
168
|
- spec/files/excel/no_content.xlsx
|
172
169
|
- spec/files/excel/with_headers.xls
|
173
170
|
- spec/files/excel/without_headers.xls
|
171
|
+
- spec/sources/copy_and_paste_spec.rb
|
172
|
+
- spec/sources/csv_spec.rb
|
173
|
+
- spec/sources/excel_spec.rb
|
174
174
|
- spec/spec_helper.rb
|
175
175
|
- table_importer.gemspec
|
176
176
|
- tasks/rspec.rake
|
@@ -200,9 +200,6 @@ specification_version: 4
|
|
200
200
|
summary: Given a file (or a string) containing a container, along with options, it
|
201
201
|
will return a hash of those values. Great for importing poorly formatted CSV files.
|
202
202
|
test_files:
|
203
|
-
- spec/copy_and_paste_spec.rb
|
204
|
-
- spec/csv_spec.rb
|
205
|
-
- spec/excel_spec.rb
|
206
203
|
- spec/files/csv/edge_cases.csv
|
207
204
|
- spec/files/csv/mexico2013_pressdoc.csv
|
208
205
|
- spec/files/csv/no_content.csv
|
@@ -212,4 +209,7 @@ test_files:
|
|
212
209
|
- spec/files/excel/no_content.xlsx
|
213
210
|
- spec/files/excel/with_headers.xls
|
214
211
|
- spec/files/excel/without_headers.xls
|
212
|
+
- spec/sources/copy_and_paste_spec.rb
|
213
|
+
- spec/sources/csv_spec.rb
|
214
|
+
- spec/sources/excel_spec.rb
|
215
215
|
- spec/spec_helper.rb
|