Commit 2f9df4d0 by liyijie

Add try_chain support

parent 41934dc2
...@@ -165,7 +165,7 @@ module TalltyImportExport ...@@ -165,7 +165,7 @@ module TalltyImportExport
end end
def try_chain record, arr def try_chain record, arr
arr.inject(record, :try) arr.reduce(record) { |r, m| r.try(m) || r.try(:[], m) }
end end
def try_method record, method def try_method record, method
......
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