Commit eba1a437 by liyijie

feat: try_chain Hash logic

parent 3f32f36b
......@@ -236,22 +236,24 @@ module TalltyImportExport
arr.reduce(record) do |r, m|
if r.is_a?(Array)
r.try(m) || r.try(:[], m.to_i)
elsif r.is_a?(Hash)
r.try(:[], m) || r.try(:[], m.to_sym)
else
data = begin
r.try(:[], m)
r.try(m)
rescue StandardError
nil
end
if data.nil?
data = begin
r.try(:[], m.to_sym)
r.try(:[], m)
rescue StandardError
nil
end
end
if data.nil?
data = begin
r.try(m)
r.try(:[], m.to_sym)
rescue StandardError
nil
end
......
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