Commit 7715fbb7 by liyijie

feat: use dig instead of fetch

parent 98349322
...@@ -116,13 +116,13 @@ module TalltyImportExport ...@@ -116,13 +116,13 @@ module TalltyImportExport
import_header_hash = import_headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access import_header_hash = import_headers.to_h { |header| [header.with_indifferent_access[:key], header] }.with_indifferent_access
@headers.map do |header| @headers.map do |header|
key = header[:key] key = header[:key]
if import_header_hash.fetch(key)&.fetch(:proc).present? if import_header_hash.dig(key, :proc).present?
header[:proc] = import_header_hash.fetch(key)&.fetch(:proc) header[:proc] = import_header_hash.dig(key, :proc)
end end
header header
end end
# rescue rescue
# @headers @headers
end end
def import_options def import_options
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment