tallty_import_export 1.0.18 → 1.0.22

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: 56c0a62d935867d8420680ac232d8c156c8c653b805534ede5880bc615514706
4
- data.tar.gz: 4efe0c40688bed288036ae32f51fe6ac7d3e28a9faddb7aa0dc05f8f901cc0c0
3
+ metadata.gz: e281a3f593eedd9a07fe79f779c95a389d02cc5f5296e799bf7c29d42f31b126
4
+ data.tar.gz: 6a7b95014024711b1eeb6136f3eafc55f51f54dcfb10f750dbf34fb73dc74c34
5
5
  SHA512:
6
- metadata.gz: b4f9e59896340ed7d75128c165d40ca8ddc4d0d584953d3953433f90bfbfe3d8cfe355cd7b4ee3182c19217a238f98c8d10b2100483b949ebc5aad1a73d31868
7
- data.tar.gz: 0f36b4f04a2bc8759b4e835cd4dcd0e051933735322a0fefb18b5a06f438a0954d269fb9c7d3e30f436b603e94c54cfedb26e4dfcf1039d92c734874c2da838e
6
+ metadata.gz: a1f2f542f68b84527e1321bf143525765568470a767bacdf3a9e8d43f14efa435e3b98e53a551b9ad14442fbd38c1175ff04c0c6d930e27aa08eb5e99e0bc122
7
+ data.tar.gz: 5fa2f4f7286b75fb5e9d14450c1233bdf95bbdb10433d1dbe66f5cf7effbe4eccb07c7414d74ac30f54642415679a4308f05bcbe7f82161713985bb8d346a5fa
@@ -165,7 +165,7 @@ module TalltyImportExport
165
165
  end
166
166
 
167
167
  def try_chain record, arr
168
- arr.inject(record, :try)
168
+ arr.reduce(record) { |r, m| r.try(m) || r.try(:[], m) }
169
169
  end
170
170
 
171
171
  def try_method record, method
@@ -179,9 +179,9 @@ module TalltyImportExport
179
179
  when 'string'
180
180
  data.to_s
181
181
  when 'datetime'
182
- data ? data.strftime('%F %H:%M') : nil
182
+ data ? data.in_time_zone.strftime('%F %H:%M') : nil
183
183
  when 'date'
184
- data ? data.strftime('%F') : nil
184
+ data ? data.in_time_zone.strftime('%F') : nil
185
185
  else
186
186
  data
187
187
  end
@@ -79,7 +79,7 @@ module TalltyImportExport
79
79
 
80
80
  def convert_data line_info
81
81
  line_info.with_indifferent_access.reduce({}) do |h, (k, v)|
82
- header = @headers.find do |_header|
82
+ header = import_headers_result.find do |_header|
83
83
  _header[:key].to_sym == k.to_sym
84
84
  end
85
85
  # header[:convert] = handle_xxx
@@ -90,9 +90,7 @@ module TalltyImportExport
90
90
  h[header[:json]][k] = val
91
91
  elsif header[:finder]
92
92
  $SAFE = 2
93
- eval_string = header[:finder] + '(val)'
94
- eval_val = eval eval_string
95
- h[k.to_sym] = eval_val
93
+ h[k.to_sym] = eval header[:finder]
96
94
  else
97
95
  h[k.to_sym] = val
98
96
  end
@@ -106,7 +104,7 @@ module TalltyImportExport
106
104
  end
107
105
 
108
106
  def import_headers_result
109
- @headers || import_headers
107
+ @headers ||= import_headers
110
108
  end
111
109
 
112
110
  def import_headers **args
@@ -1,3 +1,3 @@
1
1
  module TalltyImportExport
2
- VERSION = "1.0.18"
2
+ VERSION = "1.0.22"
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.18
4
+ version: 1.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - liyijie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-18 00:00:00.000000000 Z
11
+ date: 2021-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zip-zip