ntq_excelsior 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: b1b7c2ea8995dcb68450bc1771e8fef43e04dc6aeea67b585783378bf68bd8c1
4
- data.tar.gz: a8f6b916a1b0cca7e6ee306a9453ac802d0ce859eb1f3bf82d1aa4d8e991ef40
3
+ metadata.gz: 2534fffa978dea103d8390ddd1cd836af2f893a014420e5c40d533ecfbb36a74
4
+ data.tar.gz: e12b3fbe2bc7936ee524c2d5840192f3a052b66ae4efbfe40a04f740374c7168
5
5
  SHA512:
6
- metadata.gz: 0efaeba2512cd02f8770014c4a02c06b7245e6e42db275bd0f4d5f2a5455ca54b1aaec40fc221086d50795e706b1ec5594a5054cb7a3d6b04898abf57d795d39
7
- data.tar.gz: 3db4c3881a7a1677bd6a61b820384657cc25b2041f78463b175597b3032932f94550c7a8b941b975b18e571383dbdeb90e0e99618c873915c6aa57815c9fab0a
6
+ metadata.gz: 3875d165c478e19f7e7ced68842df945078d257c8af9e5dc0e6eb6b42ac47d558b814889dfe5c775f6f349e6382d083709fbdfa6b5c578fe45155e7166bdf905
7
+ data.tar.gz: 7bcbc5f75d39f5444c53039dbd2e3c8968b3a8ef39f756529474cf9d1656d9ef13f1376fe593373732e668d067af1625ee8a2f2938a1d7b5b3a9d59d5befd0bd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ntq_excelsior (1.0.0)
4
+ ntq_excelsior (1.0.1)
5
5
  caxlsx (< 4)
6
6
  roo (< 3)
7
7
 
@@ -54,7 +54,7 @@ module NtqExcelsior
54
54
  return @required_headers if @required_headers
55
55
 
56
56
  @required_columns = self.class.schema.select { |_field, column_config| !column_config.is_a?(Hash) || !column_config.key?(:required) || column_config[:required] }
57
- @required_headers = @required_columns.values.map { |column| get_column_header(column) }.map { |header| tranform_header_to_regexp(header) }
57
+ @required_headers = @required_columns.values.map { |column| get_column_header(column) }.map { |header| transform_header_to_regexp(header) }
58
58
  if self.class.primary_key && !@required_columns.keys.include?(self.class.primary_key)
59
59
  @required_headers.unshift(Regexp.new(self.class.primary_key.to_s, "i"))
60
60
  end
@@ -69,12 +69,14 @@ module NtqExcelsior
69
69
  missing_headers = []
70
70
 
71
71
  e.message.slice(1..-1).chop.split(",").map(&:strip).each do |header_missing|
72
- header_missing_regex = tranform_header_to_regexp(header_missing, true)
72
+ header_missing_regex = transform_header_to_regexp(header_missing, true)
73
73
  header_found = @required_columns.values.find do |column|
74
- tranform_header_to_regexp(get_column_header(column)) == header_missing_regex
74
+ transform_header_to_regexp(get_column_header(column)) == header_missing_regex
75
75
  end
76
76
  if header_found && header_found.is_a?(Hash) && header_found[:humanized_header].present?
77
77
  missing_headers << header_found[:humanized_header]
78
+ elsif header_found&.is_a?(String)
79
+ missing_headers << header_found
78
80
  else
79
81
  missing_headers << header_missing
80
82
  end
@@ -224,7 +226,7 @@ module NtqExcelsior
224
226
  column[:header]
225
227
  end
226
228
 
227
- def tranform_header_to_regexp(header, gsub_enclosure = false)
229
+ def transform_header_to_regexp(header, gsub_enclosure = false)
228
230
  return header unless header.is_a?(String)
229
231
 
230
232
  if gsub_enclosure && header.scan(/^\/[\^]?([^(\$\/)]+)[\$]?\/[i]?$/i) && $1
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NtqExcelsior
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ntq_excelsior
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin