tallty_import_export 1.0.7 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tallty_import_export/export.rb +2 -0
- data/lib/tallty_import_export/import.rb +24 -24
- data/lib/tallty_import_export/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63f572a45e25db9ed6c9750619aa2d07be0c63898d754ddd419fc3b9f54a479a
|
4
|
+
data.tar.gz: 71e22aec7b4d6e444e87c35d2844779bdb3bf44afe4eb760c140c7a7c52ef832
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b8180e95abd821119324ca582c8748f8cf89f089e7098e64ede6040bf1c1eafc8c408d00f8a17c76286cf7ea4b079ddc93d98c3ae9f05c77147e71a315eac1e
|
7
|
+
data.tar.gz: 818c4b2d0b3a96cc47bf5f8b79422029d0e03e3df607e6d5d598cf194458ffcd0c19842dda59738495cc94efa3f3e2cde7472e2eae9ce89336024de52756d9fd
|
@@ -51,7 +51,7 @@ module TalltyImportExport
|
|
51
51
|
|
52
52
|
def process_options options
|
53
53
|
options = options.with_indifferent_access
|
54
|
-
|
54
|
+
@headers = options.delete(:headers) || import_headers
|
55
55
|
@primary_keys = options.delete(:primary_keys) || @headers.map { |header| header[:primary_key] ? header[:key].to_sym : nil }.compact
|
56
56
|
|
57
57
|
@excel_hash = @headers.reduce({}) do |h, header|
|
@@ -104,29 +104,29 @@ module TalltyImportExport
|
|
104
104
|
@headers || klass.try(:headers) || klass.try(:model_headers) || (raise ArgumentError.new('missing import_headers'))
|
105
105
|
end
|
106
106
|
|
107
|
-
# 只保留 key, name, json, 合并到 import_header
|
108
|
-
def headers= val
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
end
|
107
|
+
# # 只保留 key, name, json, 合并到 import_header
|
108
|
+
# def headers= val
|
109
|
+
# if val.empty?
|
110
|
+
# @headers = import_headers_result.map { |header| header.with_indifferent_access }
|
111
|
+
# return
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# key_to_coming_header = val.reduce({}) do |out, header|
|
115
|
+
# out[header.with_indifferent_access[:key].to_sym] = header.with_indifferent_access
|
116
|
+
# out
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# result = []
|
120
|
+
# val.map do |header|
|
121
|
+
# if (exist_header = import_headers_result.find { |model_header| model_header[:key] === header[:key] })
|
122
|
+
# result.push(exist_header.merge(header.compact))
|
123
|
+
# else
|
124
|
+
# result.push(header)
|
125
|
+
# end
|
126
|
+
# end
|
127
|
+
#
|
128
|
+
# @headers = result
|
129
|
+
# end
|
130
130
|
|
131
131
|
def skip val, processing_line_info, raw_line_info
|
132
132
|
# do nothing there, use for header[:convert]
|
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.
|
4
|
+
version: 1.0.12
|
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
|
+
date: 2021-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zip-zip
|