We have an array items like this:
items = [[[["2012-09-01", 10], ["2011-09-10", 20]]], [[["2010-01-01", 23]]]]
How to reduce the 4 dimensional items to 2 dimensional array like this:
items = [["2012-09-01", 10], ["2011-09-10", 20], ["2010-01-01", 23]]
Thanks so much.
Try Array#flatten. – http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-flatten