tallty_import_export 1.0.33 → 1.0.35

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: 27824038474eaaac3d03896f311952b08a41bec424d8a5e360ee8814cf439e02
4
- data.tar.gz: b357c47d9b2ac449b58d9bc8c15c524e3ab4cf65342ca7b1df54ef834d48636b
3
+ metadata.gz: 25de46efb361ea554c4cef13898a6f14ac03e8b56cb5ca7fcbadb72ae40dcfcd
4
+ data.tar.gz: 0346d65fe26f1c9ee4357aa8b5850a86f9007c5b6da719b8b604a46ef6fe1fea
5
5
  SHA512:
6
- metadata.gz: 46b8963859ceac6a7cfaaf734aa5a32421f0d8f20800db4eaef6b21aa3a54c4d892ffa5d2f42c31224d50cff958d7acb661777c877f8bb13e790cdb009b9edb2
7
- data.tar.gz: 0c8f53e6a57eace206218376aa038f589bedc80fe4e1043ec2a85f238150216a888152942e0a68216d2d80d7b4c191fc845e16b0483b264f35e80c9248109c33
6
+ metadata.gz: 82b4c135ba29f61e1c1dbd4640b9a8c29639d9ad699474d2a02a11c6db8462269cfe46d9679fc6721258ab2a1b6cbfdc3fb59353de149d21f4cb541b62f206f3
7
+ data.tar.gz: 54d41b0b50c542827f8350d531aff8dfb80e202b2605cc9dc3cf1d6b49f8764ef7f8b367bf52782a9401c482eb2bd9cf3c684768e73bda935c7c8a8adea5c0cb
@@ -141,7 +141,7 @@ module TalltyImportExport
141
141
  end
142
142
 
143
143
  def process_options options = {}
144
- options = export_options.merge(options).with_indifferent_access
144
+ options = export_options.merge(options.compact_blank!).with_indifferent_access
145
145
 
146
146
  @row_height ||= options.delete(:row_height) || 25
147
147
  @width ||= (options.delete(:width) || 20).to_f
@@ -157,7 +157,7 @@ module TalltyImportExport
157
157
  end
158
158
 
159
159
  def export_headers_result
160
- @headers ||= export_headers&.with_indifferent_access
160
+ @headers ||= export_headers
161
161
  end
162
162
 
163
163
  def export_headers **args
@@ -53,7 +53,7 @@ module TalltyImportExport
53
53
  end
54
54
 
55
55
  def process_options options
56
- options = import_options.merge(options).with_indifferent_access
56
+ options = import_options.merge(options.compact_blank!).with_indifferent_access
57
57
  @headers = options.delete(:headers) || import_headers
58
58
  @primary_keys = options.delete(:primary_keys) || @headers.map { |header| header[:primary_key] ? header[:key].to_sym : nil }.compact
59
59
  @skip_keys = options.delete(:skip_keys) || @headers.map { |header| header[:skip] ? header[:key].to_sym : nil }.compact
@@ -113,13 +113,17 @@ module TalltyImportExport
113
113
  # TODO: 这里,对于import_headers,后面还是不要传参数了
114
114
  # 需要合并proc,前端没有办法把proc传过来
115
115
  def import_headers_result
116
- import_header_hash = import_headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access
117
- @headers.map do |header|
118
- key = header[:key]
119
- if import_header_hash.dig(key, :proc).present?
120
- header[:proc] = import_header_hash.dig(key, :proc)
116
+ if @headers.present?
117
+ import_header_hash = import_headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access
118
+ @headers.map do |header|
119
+ key = header[:key]
120
+ if import_header_hash.dig(key, :proc).present?
121
+ header[:proc] = import_header_hash.dig(key, :proc)
122
+ end
123
+ header
121
124
  end
122
- header
125
+ else
126
+ @headers = import_headers
123
127
  end
124
128
  rescue
125
129
  @headers
@@ -1,3 +1,3 @@
1
1
  module TalltyImportExport
2
- VERSION = "1.0.33"
2
+ VERSION = "1.0.35"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tallty_import_export
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.33
4
+ version: 1.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - liyijie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-11 00:00:00.000000000 Z
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zip-zip