tallty_import_export 1.0.6 → 1.0.11
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: ac670fce1d35526ff3182599152b1731126e8252b34a23ccfebb21e2fd0bdb05
|
4
|
+
data.tar.gz: c9be74623d6e5530ffeb0908de53f44ed81765d54704ce8e051de099ce4fcfa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4d825be60c8e01fb6f7390d62eafaa530d430ee9ec1f24e6a811e7664c7a565ff3ec28089cebd5ee56bfb889428b524bf71dc515704b5ee429180ed48f90ec4
|
7
|
+
data.tar.gz: e2bfd76beb5a504f35f041be64e5903aaedb31597c646c113e25024c0f8fd138c3d34d7a778a8707f432520394cd5584a68d891a7de63da4fea15a13f50d85c6
|
@@ -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]
|
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.11
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zip-zip
|