table_importer 0.0.3 → 0.0.4

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: d96649e2bb1fb93a77a49019b489b53a57d90cdc
4
- data.tar.gz: f63a9fb9cd0436e91d2d87574a1d28d6839a8766
3
+ metadata.gz: cd84285c3a82fbc6de03c8f3f8e4891ac9587e63
4
+ data.tar.gz: 9ad7d89998a2f9e98f1501968275ca28c5c8b6c7
5
5
  SHA512:
6
- metadata.gz: afa372753ff8d5ec9f2f3f9cecfddb79c12a4515281bf1eed10d074ba1337e4c83d515670a5453efcc9b53e9c6bc14305ab3bff078a20eb6d35bbc8a46a2b0f4
7
- data.tar.gz: d505d9da61e7e52e3b989f23d56d31e27e9c138063f1749be435a12a13216d88683b587f71ace951a21b2d72fb319979743897294bc9e882a290b530fdb9aa30
6
+ metadata.gz: 814a258443231c3b4329cadc44da9d5f1d1c3cdbe365b9c97db0d5bf867d47612ff8e2bc750a445be982f3066d29bba6b7eb6a89201bae03cc318041c883f884
7
+ data.tar.gz: b53895f0aa9946ba7510fffa33ad356f46dbf5774db0ef134deba95cbdce9b6b407b19ee1476c6f53146a0292c1b33045a89bd37e3d3df2da63562e4705b9c77
@@ -24,6 +24,11 @@ module TableImporter
24
24
 
25
25
  def data_conforms_pattern(col_sep, rec_sep)
26
26
  # Check to see if data is of bcc style
27
+ first_item = @data.split("\n")[1]
28
+ if first_item.present? && first_item.match(/\S@\S/) && !first_item.match(/;|,|\s/)
29
+ rec_sep = "\n"
30
+ col_sep = " "
31
+ end
27
32
  first_item = @data.split(",").first
28
33
  if first_item.present? && first_item.match(/\S@\S/)
29
34
  if first_item.match(/<(\S+@\S+)/)
@@ -15,7 +15,7 @@ module TableImporter
15
15
  if !data[:headers].nil?
16
16
  @headers = data[:headers]
17
17
  else
18
- @headers = @headers_present ? @file.row(1).map { |header| header.to_sym } : default_headers
18
+ @headers = @headers_present ? @file.row(1).map { |header| header.to_sym unless header.nil?} : default_headers
19
19
  end
20
20
  rescue NoMethodError
21
21
  raise Exceptions::HeaderMismatchError.new
@@ -1,3 +1,3 @@
1
1
  module TableImporter
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Dowse