tallty_import_export 1.0.5 → 1.0.10
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a04b3934c446e2bbf669f01a5e3db5f5cb898a10be14c46da3388b0d45f11ede
|
4
|
+
data.tar.gz: f4f1fa8e5cd8d58a52ecd6b82c7547181ee11078c41eeec4a22f4ada037de3c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc7e2b3836f2feebbc23d4844079c57a78b470a7f103d4efd78d456ad4e6b574745668c99054375add3bbc936a62648b0340ab562a977f3b26df4856099a2a9a
|
7
|
+
data.tar.gz: 8eff47ec5ea1fa31a819c74f13073f23374819c70f7218ecaebbdfb3853fbb07a84f77943d80a0c55b7f8152afaa1cd68b94a207039b8876040ca52f5627ba73
|
@@ -51,10 +51,10 @@ module TalltyImportExport
|
|
51
51
|
|
52
52
|
def process_options options
|
53
53
|
options = options.with_indifferent_access
|
54
|
-
|
55
|
-
@primary_keys = options.delete(:primary_keys) || headers.map { |header| header[:primary_key] ? header[:key].to_sym : nil }.compact
|
54
|
+
@headers = options.delete(:headers)
|
55
|
+
@primary_keys = options.delete(:primary_keys) || @headers.map { |header| header[:primary_key] ? header[:key].to_sym : nil }.compact
|
56
56
|
|
57
|
-
@excel_hash = headers.reduce({}) do |h, header|
|
57
|
+
@excel_hash = @headers.reduce({}) do |h, header|
|
58
58
|
h[header[:key].to_sym] = header[:name]
|
59
59
|
h
|
60
60
|
end
|
@@ -75,7 +75,7 @@ module TalltyImportExport
|
|
75
75
|
|
76
76
|
def convert_data line_info
|
77
77
|
line_info.with_indifferent_access.reduce({}) do |h, (k, v)|
|
78
|
-
header = headers.find do |_header|
|
78
|
+
header = @headers.find do |_header|
|
79
79
|
_header[:key].to_sym == k.to_sym
|
80
80
|
end
|
81
81
|
# header[:convert] = handle_xxx
|
@@ -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]
|
Binary file
|
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.10
|
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
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- lib/tallty_import_export/importable.rb
|
151
151
|
- lib/tallty_import_export/version.rb
|
152
152
|
- tallty_import_export-1.0.3.gem
|
153
|
+
- tallty_import_export-1.0.5.gem
|
153
154
|
- tallty_import_export.gemspec
|
154
155
|
homepage: https://git.tallty.com/open-source/tallty_import_export
|
155
156
|
licenses:
|