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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20ec051b84c0c965ad0ca1277f1e3b485e9cf026fd261a5638a98f43089e89bb
4
- data.tar.gz: d79f1efedffeff6d933411c761547597d3c6fa2dc3f685c58e6a6fb311db5ab9
3
+ metadata.gz: ac670fce1d35526ff3182599152b1731126e8252b34a23ccfebb21e2fd0bdb05
4
+ data.tar.gz: c9be74623d6e5530ffeb0908de53f44ed81765d54704ce8e051de099ce4fcfa4
5
5
  SHA512:
6
- metadata.gz: 16bac50a5b23ca990021797d567086213b822d639940d9061cf31d1c14fa2023357642ec901b30813a3da83544f0f5c3f0e467ccc2845a3b8a20091b29f74bb7
7
- data.tar.gz: 0c9640845a79b9bc44a3566ade9710b56bb633de42550528c0c36c0b4dc0c7b630e1d0624471c24fd64830f94519e8136ec3fc66aba0248da45883494a7956c2
6
+ metadata.gz: c4d825be60c8e01fb6f7390d62eafaa530d430ee9ec1f24e6a811e7664c7a565ff3ec28089cebd5ee56bfb889428b524bf71dc515704b5ee429180ed48f90ec4
7
+ data.tar.gz: e2bfd76beb5a504f35f041be64e5903aaedb31597c646c113e25024c0f8fd138c3d34d7a778a8707f432520394cd5584a68d891a7de63da4fea15a13f50d85c6
@@ -174,6 +174,8 @@ module TalltyImportExport
174
174
  # 根据数据类型 attr_type 进行数据的格式化
175
175
  def handle_format data, header
176
176
  case header[:attr_type].to_s
177
+ when 'string'
178
+ data.to_s
177
179
  when 'datetime'
178
180
  data ? data.strftime('%F %H:%M') : nil
179
181
  when 'date'
@@ -51,7 +51,7 @@ module TalltyImportExport
51
51
 
52
52
  def process_options options
53
53
  options = options.with_indifferent_access
54
- self.headers = options.delete(:headers) || []
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
- 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(name: header[:name], json: header[:json]))
123
- else
124
- result.push({ key: header[:key], name: header[:name], json: header[:json]})
125
- end
126
- end
127
-
128
- @headers = result
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]
@@ -1,3 +1,3 @@
1
1
  module TalltyImportExport
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.11"
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.6
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-05-26 00:00:00.000000000 Z
11
+ date: 2021-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zip-zip