tallty_import_export 1.0.7 → 1.0.8
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/import.rb +24 -24
- data/lib/tallty_import_export/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7d7ca21a9a6d55f1bb3aaef470e0c683afbaee5302e56f911715f2514cdba9b
|
4
|
+
data.tar.gz: c9f7b882eecee3883d1e07ef89187a8f8d672251dde4d51a647b5eca072a14ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f829b2d625ce5f10e131ed66f0f7c088c26e9855cd878fd6d27a95e78fbe9931180233624bbfa12d1ee8973be03d9334860f7d265c7dd772e37aa1f696ebf5ec
|
7
|
+
data.tar.gz: 16461d52726acc91a0eb5af83a942539b6fe70ffd9e47caed5d8bcd48626b7ff8ca3832df5f2232f601f3fc82a70c92ff770de68211e22dfbf630a66e711e30d
|
@@ -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) || []
|
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]
|