table_importer 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: 4994496bd6e86e906b1f25889bd9551dfbdf801f
4
- data.tar.gz: bb68d1580e0031ffc1a5edbf31d2c5126f6f3bf9
3
+ metadata.gz: d96649e2bb1fb93a77a49019b489b53a57d90cdc
4
+ data.tar.gz: f63a9fb9cd0436e91d2d87574a1d28d6839a8766
5
5
  SHA512:
6
- metadata.gz: 99358cc46d8a2a2fca47b30edb8e00c5e5f07fcb5d02c5c4a6b476a857deda5eea80fd0cad29c8ad6860498295c2ae6b8c8049a770fab038dfcf4a5bb0aaeaae
7
- data.tar.gz: 745ab97ac7b83a328210d2008f08c08a36c80872b010fd0b9d7e16ad505070d8a9712c0d453e4d202f4207402006213285d3d3b6a59381d07875a64544566186
6
+ metadata.gz: afa372753ff8d5ec9f2f3f9cecfddb79c12a4515281bf1eed10d074ba1337e4c83d515670a5453efcc9b53e9c6bc14305ab3bff078a20eb6d35bbc8a46a2b0f4
7
+ data.tar.gz: d505d9da61e7e52e3b989f23d56d31e27e9c138063f1749be435a12a13216d88683b587f71ace951a21b2d72fb319979743897294bc9e882a290b530fdb9aa30
@@ -1,7 +1,5 @@
1
1
  module TableImporter
2
- # require classes
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
- headers.each do |header|
143
- chunk[:lines][0][header] = "empty_column"
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
@@ -1,3 +1,3 @@
1
1
  module TableImporter
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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